Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331702

Summary: [dom] Static imports are always malformed in OTDT
Product: [Tools] Objectteams Reporter: Jan Marc Hoffmann <exelnet>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: arlindolima, stephan.herrmann
Version: 0.7.1   
Target Milestone: 0.8 M4   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
fix none

Description Jan Marc Hoffmann CLA 2010-12-02 13:14:47 EST
In ASTConverter.convertImport(org.eclipse.jdt.internal.compiler.ast.ImportReference importReference)

I found the following code:

		if (modifiers != ClassFileConstants.AccDefault) {
			switch(this.ast.apiLevel) {
				case AST.JLS2_INTERNAL :
					importDeclaration.setFlags(importDeclaration.getFlags() | ASTNode.MALFORMED);
					break;
				case AST.JLS3 :
					if (modifiers == ClassFileConstants.AccStatic) {
						importDeclaration.setStatic(true);
					} else {
						importDeclaration.setFlags(importDeclaration.getFlags() | ASTNode.MALFORMED);
					}
//{ObjectTeams: base imports:
					if (modifiers == ExtraCompilerModifiers.AccBase) {
						importDeclaration.setBase(true);
					} else {
						importDeclaration.setFlags(importDeclaration.getFlags() | ASTNode.MALFORMED);
					}
// SH}
			}
		}

This will make all static imports malformed. Shouldn't this be an else if?

thanks and greetings

Jan Marc
Comment 1 Stephan Herrmann CLA 2010-12-02 15:56:37 EST
Well spotted. Thanks.

That's actually the kind of defect I would have hoped the original
JDT test suite would detect.
Maybe we can improve the JDT tests in this regard ...
Comment 2 Jan Marc Hoffmann CLA 2010-12-02 16:39:29 EST
(In reply to comment #1)
> Well spotted. Thanks.
> 
> That's actually the kind of defect I would have hoped the original
> JDT test suite would detect.
> Maybe we can improve the JDT tests in this regard ...

Well its quite a special case. Its no wonder a test hasn't triggered this bug since its not that critical. But still I am hoping to run the GOT OT extension through the Eclipse + OT tests. :=)
Comment 3 Stephan Herrmann CLA 2010-12-02 18:50:05 EST
Created attachment 184425 [details]
fix

This patch contains the (simple) fix.

Corresponding improvements of the jdt tests are in bug 331736.
Comment 4 Stephan Herrmann CLA 2010-12-02 18:53:55 EST
Fix has been committed to trunk (r1117).

Please reopen if you need it fixed also in 0.7.x
Comment 5 Stephan Herrmann CLA 2010-12-16 14:55:15 EST
Verified for M4 using build 201012150343 (using code inspection).

Additionally, once we move towards M5 the extra checks from bug 331736 
will be executed during all tests.
Comment 6 Olivier Thomann CLA 2011-01-17 17:34:00 EST
*** Bug 334355 has been marked as a duplicate of this bug. ***