Community
Participate
Working Groups
Using HEAD, I got: java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.ast.FieldDeclaration cannot be cast to org.eclipse.jdt.internal.compiler.ast.TypeDeclaration at org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(CompilationUnitResolver.java:430) at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:887) at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:653) at org.eclipse.jdt.core.tests.dom.ConverterTestSetup.runConversion(ConverterTestSetup.java:452) at org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0688(ASTConverterTestAST3_2.java:9567) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:120) at junit.framework.TestSuite.runTest(TestSuite.java:230) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.runTest(SuiteOfTestCases.java:100) at junit.framework.TestSuite.run(TestSuite.java:225) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.superRun(SuiteOfTestCases.java:84) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$1.protect(SuiteOfTestCases.java:72) at junit.framework.TestResult.runProtected(TestResult.java:124) at org.eclipse.jdt.core.tests.model.SuiteOfTestCases$Suite.run(SuiteOfTestCases.java:81) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethod(EclipseAppContainer.java:547) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:195) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:362) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:564) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1251) at org.eclipse.equinox.launcher.Main.main(Main.java:1227) when trying to create a compilation unit declaration using setFocalPosition(int) where the focal position is the position of a field name.
I'll fix it since I need it for api tooling.
Jérôme, you might want to backport to 3.3.2 since this throws an exception and there is no workaround for the position that corresponds to a field name. The fix is trivial and risk free.
Created attachment 87297 [details] Proposed fix + regression test
Fixed and released for 3.4M5. Regression test added in: org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0688
+1 for 3.3.2. It looks bad, fix is trivial, and we need to reopen the box to contribute fix for bug 215843... so let's take it as well.
Reopen to release for 3.3.2.
Created attachment 87552 [details] Proposed fix + regression test for 3.3.x maintenance stream
Agreed to backport to 3.3.2 since: - there is no workaround - the exception is bad - the fix is simple - the fix is safe
Marking FIXED since it was already released for 3.3.2
Verified for 3.3.2 using M20080123-0800 build.
Verified for 3.4M5 using I20080204-0010