Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331702 - [dom] Static imports are always malformed in OTDT
Summary: [dom] Static imports are always malformed in OTDT
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTDT (show other bugs)
Version: 0.7.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 0.8 M4   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 334355 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-02 13:14 EST by Jan Marc Hoffmann CLA
Modified: 2011-01-17 17:34 EST (History)
2 users (show)

See Also:


Attachments
fix (918 bytes, patch)
2010-12-02 18:50 EST, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***