Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 165615 Details for
Bug 310002
ToolFactory.createScanner(..) should use workspace compliance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated patch with javadoc changes
patch_310002.txt (text/plain), 9.69 KB, created by
Olivier Thomann
on 2010-04-21 14:12:26 EDT
(
hide
)
Description:
Updated patch with javadoc changes
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-04-21 14:12:26 EDT
Size:
9.69 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/core/ToolFactory.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java,v >retrieving revision 1.81 >diff -u -r1.81 ToolFactory.java >--- model/org/eclipse/jdt/core/ToolFactory.java 21 Apr 2010 13:06:32 -0000 1.81 >+++ model/org/eclipse/jdt/core/ToolFactory.java 21 Apr 2010 18:11:55 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.core.resources.IFile; > import org.eclipse.core.runtime.*; > import org.eclipse.jdt.core.compiler.IScanner; >+import org.eclipse.jdt.core.compiler.ITerminalSymbols; > import org.eclipse.jdt.core.formatter.CodeFormatter; > import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants; > import org.eclipse.jdt.core.util.ClassFileBytesDisassembler; >@@ -377,26 +378,38 @@ > * </pre> > * </code> > * >- * <p> >- * The returned scanner will tolerate unterminated line comments (missing line separator). It can be made stricter >- * by using API with extra boolean parameter (<code>strictCommentMode</code>). >- * <p> >+ * <p>By default the compliance used to create the scanner is the workspace's compliance when running inside the IDE >+ * or 1.4 if running from outside of a headless eclipse. >+ * </p> >+ * > * @param tokenizeComments if set to <code>false</code>, comments will be silently consumed > * @param tokenizeWhiteSpace if set to <code>false</code>, white spaces will be silently consumed, > * @param assertMode if set to <code>false</code>, occurrences of 'assert' will be reported as identifiers >- * (<code>ITerminalSymbols#TokenNameIdentifier</code>), whereas if set to <code>true</code>, it >- * would report assert keywords (<code>ITerminalSymbols#TokenNameassert</code>). Java 1.4 has introduced >+ * ({@link ITerminalSymbols#TokenNameIdentifier}), whereas if set to <code>true</code>, it >+ * would report assert keywords ({@link ITerminalSymbols#TokenNameassert}). Java 1.4 has introduced > * a new 'assert' keyword. > * @param recordLineSeparator if set to <code>true</code>, the scanner will record positions of encountered line > * separator ends. In case of multi-character line separators, the last character position is considered. These positions >- * can then be extracted using <code>IScanner#getLineEnds</code>. Only non-unicode escape sequences are >+ * can then be extracted using {@link IScanner#getLineEnds()}. Only non-unicode escape sequences are > * considered as valid line separators. > * @return a scanner > * @see org.eclipse.jdt.core.compiler.IScanner >+ * @see #createScanner(boolean, boolean, boolean, String, String) > */ > public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean assertMode, boolean recordLineSeparator){ >- >- PublicScanner scanner = new PublicScanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/, assertMode ? ClassFileConstants.JDK1_4 : ClassFileConstants.JDK1_3/*sourceLevel*/, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/); >+ // use default workspace compliance >+ long complianceLevelValue = CompilerOptions.versionToJdkLevel(JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE)); >+ if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_4; // fault-tolerance >+ PublicScanner scanner = >+ new PublicScanner( >+ tokenizeComments, >+ tokenizeWhiteSpace, >+ false/*nls*/, >+ assertMode ? ClassFileConstants.JDK1_4 : ClassFileConstants.JDK1_3/*sourceLevel*/, >+ complianceLevelValue, >+ null/*taskTags*/, >+ null/*taskPriorities*/, >+ true/*taskCaseSensitive*/); > scanner.recordLineSeparator = recordLineSeparator; > return scanner; > } >@@ -418,29 +431,41 @@ > * </pre> > * </code> > * >- * <p> >- * The returned scanner will tolerate unterminated line comments (missing line separator). It can be made stricter >- * by using API with extra boolean parameter (<code>strictCommentMode</code>). >- * <p> >+ * <p>By default the compliance used to create the scanner is the workspace's compliance when running inside the IDE >+ * or 1.4 if running from outside of a headless eclipse. >+ * </p> >+ * > * @param tokenizeComments if set to <code>false</code>, comments will be silently consumed > * @param tokenizeWhiteSpace if set to <code>false</code>, white spaces will be silently consumed, > * @param recordLineSeparator if set to <code>true</code>, the scanner will record positions of encountered line > * separator ends. In case of multi-character line separators, the last character position is considered. These positions >- * can then be extracted using <code>IScanner#getLineEnds</code>. Only non-unicode escape sequences are >+ * can then be extracted using {@link IScanner#getLineEnds()}. Only non-unicode escape sequences are > * considered as valid line separators. > * @param sourceLevel if set to <code>"1.3"</code> or <code>null</code>, occurrences of 'assert' will be reported as identifiers >- * (<code>ITerminalSymbols#TokenNameIdentifier</code>), whereas if set to <code>"1.4"</code>, it >- * would report assert keywords (<code>ITerminalSymbols#TokenNameassert</code>). Java 1.4 has introduced >+ * ({@link ITerminalSymbols#TokenNameIdentifier}), whereas if set to <code>"1.4"</code>, it >+ * would report assert keywords ({@link ITerminalSymbols#TokenNameassert}). Java 1.4 has introduced > * a new 'assert' keyword. >- * @return a scanner >+ * @return a scanner > * @see org.eclipse.jdt.core.compiler.IScanner >- * @since 3.0 >+ * @see #createScanner(boolean, boolean, boolean, String, String) >+ * @since 3.0 > */ > public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator, String sourceLevel) { >- PublicScanner scanner = null; >- long level = CompilerOptions.versionToJdkLevel(sourceLevel); >- if (level == 0) level = ClassFileConstants.JDK1_3; // fault-tolerance >- scanner = new PublicScanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/,level /*sourceLevel*/, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/); >+ // use default workspace compliance >+ long complianceLevelValue = CompilerOptions.versionToJdkLevel(JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE)); >+ if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_4; // fault-tolerance >+ long sourceLevelValue = CompilerOptions.versionToJdkLevel(sourceLevel); >+ if (sourceLevelValue == 0) sourceLevelValue = ClassFileConstants.JDK1_3; // fault-tolerance >+ PublicScanner scanner = >+ new PublicScanner( >+ tokenizeComments, >+ tokenizeWhiteSpace, >+ false/*nls*/, >+ sourceLevelValue /*sourceLevel*/, >+ complianceLevelValue, >+ null/*taskTags*/, >+ null/*taskPriorities*/, >+ true/*taskCaseSensitive*/); > scanner.recordLineSeparator = recordLineSeparator; > return scanner; > } >@@ -462,33 +487,29 @@ > * </pre> > * </code> > * >- * <p> >- * The returned scanner will tolerate unterminated line comments (missing line separator). It can be made stricter >- * by using API with extra boolean parameter (<code>strictCommentMode</code>). >- * <p> > * @param tokenizeComments if set to <code>false</code>, comments will be silently consumed > * @param tokenizeWhiteSpace if set to <code>false</code>, white spaces will be silently consumed, > * @param recordLineSeparator if set to <code>true</code>, the scanner will record positions of encountered line > * separator ends. In case of multi-character line separators, the last character position is considered. These positions >- * can then be extracted using <code>IScanner#getLineEnds</code>. Only non-unicode escape sequences are >+ * can then be extracted using {@link IScanner#getLineEnds()}. Only non-unicode escape sequences are > * considered as valid line separators. > * @param sourceLevel if set to <code>"1.3"</code> or <code>null</code>, occurrences of 'assert' will be reported as identifiers >- * (<code>ITerminalSymbols#TokenNameIdentifier</code>), whereas if set to <code>"1.4"</code>, it >- * would report assert keywords (<code>ITerminalSymbols#TokenNameassert</code>). Java 1.4 has introduced >+ * ({@link ITerminalSymbols#TokenNameIdentifier}), whereas if set to <code>"1.4"</code>, it >+ * would report assert keywords ({@link ITerminalSymbols#TokenNameassert}). Java 1.4 has introduced > * a new 'assert' keyword. > * @param complianceLevel This is used to support the Unicode 4.0 character sets. if set to 1.5 or above, > * the Unicode 4.0 is supporte, otherwise Unicode 3.0 is supported. >- * @return a scanner >+ * @return a scanner > * @see org.eclipse.jdt.core.compiler.IScanner > * >- * @since 3.1 >+ * @since 3.1 > */ > public static IScanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean recordLineSeparator, String sourceLevel, String complianceLevel) { > PublicScanner scanner = null; > long sourceLevelValue = CompilerOptions.versionToJdkLevel(sourceLevel); > if (sourceLevelValue == 0) sourceLevelValue = ClassFileConstants.JDK1_3; // fault-tolerance > long complianceLevelValue = CompilerOptions.versionToJdkLevel(complianceLevel); >- if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_3; // fault-tolerance >+ if (complianceLevelValue == 0) complianceLevelValue = ClassFileConstants.JDK1_4; // fault-tolerance > scanner = new PublicScanner(tokenizeComments, tokenizeWhiteSpace, false/*nls*/,sourceLevelValue /*sourceLevel*/, complianceLevelValue, null/*taskTags*/, null/*taskPriorities*/, true/*taskCaseSensitive*/); > scanner.recordLineSeparator = recordLineSeparator; > return scanner;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 310002
:
165609
| 165615