Bug 357029 - 'as' is not a valid identifier, breaks org.apache.xerces.dom3.as package
Summary: 'as' is not a valid identifier, breaks org.apache.xerces.dom3.as package
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTDT (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-07 23:01 EDT by bugmenot CLA
Modified: 2012-01-31 14:59 EST (History)
1 user (show)

See Also:


Attachments
screenshot of "'as' is not a valid identifier" error (49.31 KB, image/png)
2011-09-07 23:03 EDT, bugmenot CLA
no flags Details
screenshot of library breakage (20.54 KB, image/png)
2011-09-07 23:04 EDT, bugmenot CLA
no flags Details
fix (1.29 KB, patch)
2011-09-08 13:35 EDT, Stephan Herrmann CLA
no flags Details | Diff
fix part 2 (954 bytes, patch)
2011-09-10 10:13 EDT, 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 bugmenot CLA 2011-09-07 23:01:59 EDT
Build Identifier: I20110613-1736

This is not a report on the OJDT feature itself, but on a basic Helios install with JDT, and the OJDT patch installed after it was erroneously offered by the automatic updates.  After the patch, creating a java package or java class in a java project with the name "as" is not allowed (see screenshot).  This also has the effect of excluding classes under an "as" package from imported libraries (see screenshot showing exclusion of org.apache.xerces.dom3.as.*).

Reproducible: Always

Steps to Reproduce:
1. Create new Java class with name "as"
2. see validation failure
Comment 1 bugmenot CLA 2011-09-07 23:03:45 EDT
Created attachment 202958 [details]
screenshot of "'as' is not a valid identifier" error
Comment 2 bugmenot CLA 2011-09-07 23:04:49 EDT
Created attachment 202959 [details]
screenshot of library breakage
Comment 3 bugmenot CLA 2011-09-07 23:07:52 EDT
Unfortunately in the description I said it was a Helios install.  In fact this is an Indigo x86_64 install.
Comment 4 Stephan Herrmann CLA 2011-09-08 07:42:26 EDT
This issue has two parts:

It is not intended to offer the OT patch as an *update* if no Object Teams
feature was previously installed. This seems to be the same as bug 350133.

Even with the OT patch installed we strive for greatest possible
compatibility, so in this bug I will investigate whether we can improve
the switching in the scanner, so that Object Teams keywords will be
accepted as normal Java identifiers in more situations.
Comment 5 Stephan Herrmann CLA 2011-09-08 13:35:57 EDT
Created attachment 203014 [details]
fix

This patch makes the implementation more conservative:
The utility class JavaConventions has no context about the current project,
thus we cannot determine whether it is a Java or an OT/J project.

To avoid undesired effects in a pure Java project we'll now always assume
pure Java here. This means that in OT/J projects a few names are allowed
which shouldn't be, but at least the compiler will still detect these.

It is better to miss some warnings in OT/J code rather than raising
bogus errors in pure Java projects.
Comment 6 Stephan Herrmann CLA 2011-09-08 13:42:45 EDT
Patch has been released. This indeed resolves both issues reported
(re new class wizard and package in imported library).

In anticipation that more people might be affected by the unintended install
when SR1 ships I'm raising the priority and I'll try to get this into the 
SR1 release. Tests are currently running.
Comment 7 Stephan Herrmann CLA 2011-09-10 10:13:59 EDT
Created attachment 203109 [details]
fix part 2

During further testing I found one more location needing the same change:
also the indexer skipped packages with name "as", thus several features
like code completion, label decoration ... did not see classes inside
the "as" package inside the jar file.

Fixed by applying the same more conservative settings also for the indexer.

The only other client of Scanner.scanIdentifier() is ...dom.SimpleName
which has sufficient context to detect OT/J vs. plain Java code.
Comment 8 Stephan Herrmann CLA 2011-09-20 06:48:10 EDT
Also released for 2.1 M2 (r2026)
Comment 9 Stephan Herrmann CLA 2012-01-31 14:59:34 EST
Verified using build 201201310618