Community
Participate
Working Groups
Build Identifier: M20100909-0800 In the example Imports.java file below (in Steps to Reproduce), the import: import static testepackage.StaticTest.cos; is flagged as malformed. Another issue: the IMethodBinding of the "cos" import declaration, corresponds to the _last_ "cons" method declared in StaticTest. Is this the intended behaviour? Reproducible: Always Steps to Reproduce: 1. Create a project with the following two classes: ****************************************************************** File testepackage/StaticTest.java ****************************************************************** package testepackage; public class StaticTest { public static int cos() { return 3; } public static int cos( int x) { return x; } public static int cos( int x, Double z) { return 2; } } ****************************************************************** File testepackage/Imports.java ****************************************************************** package testepackage; import static testepackage.StaticTest.cos; // MALFORMED public class Imports { void method() { cos(); } }
I've now noticed a simple: import static java.lang.Math.*; is also consideed malformed.
What source settings is used to build the DOM ?
This is the code I'm using: ASTParser parser = ASTParser.newParser( AST.JLS3); parser.setKind( ASTParser.K_COMPILATION_UNIT); parser.setSource( cUnit); parser.setResolveBindings( true); Map<?, ?> options = JavaCore.getOptions(); JavaCore.setComplianceOptions( JavaCore.VERSION_1_5, JavaCore.getOptions()); parser.setCompilerOptions(options); parser.createAST(null /* IProgressMonitor */);
I cannot reproduce. I only get the MALFORMED node if the compliance/source are set to 1.4 or if I don't use the JLS3 kind.
I might be wrong. I'll add more info tomorrow.
Created attachment 186828 [details] Add regression test This patch reflects the submitted test case and shows that the import declaration node is not malformed.
I confirm this bug. They're flagged as malformed. This also happens with eclipse 3.4 (with ASTView installed). I have the ObjectTeams plug-in installed. Could that be introducing errors?
(In reply to comment #7) > I confirm this bug. They're flagged as malformed. This also happens with > eclipse 3.4 (with ASTView installed). > I have the ObjectTeams plug-in installed. Could that be introducing errors? Stephan, any idea about this ? I could not reproduce if the compiler settings are set to 1.5 and the JLS level is JLS3. Is it possible to provide a test case that is causing the problem ? I tried what was given in comment 3 and I could not reproduce. If you can reproduce without having Object team installed this would help to narrow it down.
(In reply to comment #8) > (In reply to comment #7) > > I confirm this bug. They're flagged as malformed. This also happens with > > eclipse 3.4 (with ASTView installed). > > I have the ObjectTeams plug-in installed. Could that be introducing errors? > Stephan, any idea about this ? sorry, this slipped my attention. Looks like bug 331702 (in OTDT) (the one which gave rise to bug 331736 in JDT). Arlindo, could you try if it also occurs in M4 (Eclipse 3.7M4 with OTDT 0.8M4) ?
(In reply to comment #9) > Looks like bug 331702 (in OTDT) (the one which gave rise to bug 331736 in JDT). Looks like it. Moving to Objectteams to close as a duplicate. *** This bug has been marked as a duplicate of bug 331702 ***
Didn't notice the other bug. Fortunately, it has been solved.
(In reply to comment #11) > Didn't notice the other bug. Fortunately, it has been solved. Feel free to re-open if you still see the bug with M4. Also: when in doubt please file future bugs against Object Teams. If it's not in the OT code, I'll quickly re-assign to JDT. It's better not to waste the time of the JDT team :)