Community
Participate
Working Groups
BETA_JAVA8: The following program fails to get formatted properly. If you change the intersection type cast to a normal cast, all is well: // ---- import java.io.Serializable; interface I { void doit(); } class X { void foo( int x , int y ) {} I i = (I & Serializable ) () -> {}; }
Jesper, Thanks for following up.
Created attachment 228752 [details] Test and patch for this Note that I don't really like to continue the pattern of inserting 2 lexically identical method implementations for BlockScope and MethodScope, but I guess that's a case for a different bug. Since the scopes are going to be null for formatting anyway, we could just delegate to one from the other, couldn't we?
(In reply to comment #2) > Created attachment 228752 [details] > Test and patch for this > > Note that I don't really like to continue the pattern of inserting 2 > lexically identical method implementations for BlockScope and MethodScope, > but I guess that's a case for a different bug. I think you meant BlockScope and ClassScope. I got rid of the latter format visit method for IntersectionCastTypeReference since it will never be entered. IntersectionTypeReference can only in a occur in a cast and a cast can only occur in a MethodScope (which is a BlockScope). See that CastExpression defines a single traverse method that traverses only in BlockScope. (we create MethodScopes for field initialization, static blocks and initializer blocks) (I also replaced the implementation of ClassScope travese method in IntersectionCastTypeReference with a throw of UOE.) (In future, please also throw in a few 308 style annotations here and there in formatter tests - it doesn't hurt to test them in various contexts) Patch is good. Fix and tests released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=79363a0cf2877d51c36b4085a9d2b719b103bf6c Thanks Jesper.