Community
Participate
Working Groups
I haven't done a full examination of the problem but when I switched from 3.1M6 to 3.1M7 my app is now throwing: java.lang.UnsupportedOperationException: Operation not supported in JLS2 AST at org.eclipse.jdt.core.dom.ASTNode.unsupportedIn2(ASTNode.java:1758) at org.eclipse.jdt.core.dom.SingleVariableDeclaration.isVarargs(SingleVariableDeclaration.java:553) at org.eclipse.jdt.core.dom.MethodBinding.getUnresolvedJavaElement(MethodBinding.java:182) at org.eclipse.jdt.core.dom.MethodBinding.getJavaElement(MethodBinding.java:161) It seems that lines 180 - 185 of org.eclipse.jdt.core.dom.MethodBinding were added between 3.1M6 and 3.1M7: String typeSig = Util.getSignature(type); int arrayDim = parameter.getExtraDimensions(); if (parameter.isVarargs()) arrayDim++; if (arrayDim > 0) typeSig = Signature.createArraySignature(typeSig, arrayDim); When using a JLS2 AST from: org.eclipse.jdt.core.dom.ASTParser.newParser(AST.JLS2) calling IMethodBinding.getJavaElement() causes an exception to be thrown. It seems that AST.JLS2 is now deprecated but that shouldn't mean that functionality that depends on it is broken? My application specifically excludes 1.5 (JLS3) functionality so am I forced to use JLS3 and deal with the consequences?
I will investigate it.
JLS3 doesn't mean it is for 1.5 code only. JLS3 can be used for any kind of code. This is a bug, but you should definitely move your code to JLS3.
I know that I have to move to JLS3 eventually but I was hoping to put it off as long as possible. I was using JLS2 to allow me to cull out a number of things that I didn't want to have to think about yet. I guess that now is as good a time as any to get off my lazy keister. Is JLS2 a priority for 3.1? I'm assuming "yes" for backwards compatibility.
I would say yes. JLS2 should work.
Added a protection for JLS3. isVarargs() is only used if the api level is greater or equals to JLS3. Fixed and released in HEAD. Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverterTest2.test0606
Verified for 3.1 RC1 with build I20050527-0010.
Confirm verified in 3.1 RC1 Thanks!