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 57669 Details for
Bug 161996
[compiler][batch][options] ecj can't cope with [] brackets in classpath names
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for v_732 (N20070127-0010) with and updated test
eclipse-square-bracket-classpath-fix-with-test-3.3.patch (text/plain), 10.54 KB, created by
Ben Konrath
on 2007-01-29 00:11:32 EST
(
hide
)
Description:
patch for v_732 (N20070127-0010) with and updated test
Filename:
MIME Type:
Creator:
Ben Konrath
Created:
2007-01-29 00:11:32 EST
Size:
10.54 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: batch/org/eclipse/jdt/internal/compiler/batch/Main.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java,v >retrieving revision 1.277 >diff -u -r1.277 Main.java >--- batch/org/eclipse/jdt/internal/compiler/batch/Main.java 17 Jan 2007 02:36:07 -0000 1.277 >+++ batch/org/eclipse/jdt/internal/compiler/batch/Main.java 29 Jan 2007 04:54:27 -0000 >@@ -29,10 +29,12 @@ > import java.text.MessageFormat; > import java.util.ArrayList; > import java.util.Arrays; >+import java.util.Collections; > import java.util.Comparator; > import java.util.Date; > import java.util.HashMap; > import java.util.Iterator; >+import java.util.LinkedList; > import java.util.Locale; > import java.util.Map; > import java.util.MissingResourceException; >@@ -42,8 +44,8 @@ > > import org.eclipse.jdt.core.compiler.CategorizedProblem; > import org.eclipse.jdt.core.compiler.CharOperation; >-import org.eclipse.jdt.core.compiler.InvalidInputException; > import org.eclipse.jdt.core.compiler.IProblem; >+import org.eclipse.jdt.core.compiler.InvalidInputException; > import org.eclipse.jdt.internal.compiler.AbstractAnnotationProcessorManager; > import org.eclipse.jdt.internal.compiler.ClassFile; > import org.eclipse.jdt.internal.compiler.CompilationResult; >@@ -63,9 +65,9 @@ > import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; > import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; > import org.eclipse.jdt.internal.compiler.util.GenericXMLWriter; >+import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; > import org.eclipse.jdt.internal.compiler.util.Messages; > import org.eclipse.jdt.internal.compiler.util.SuffixConstants; >-import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; > import org.eclipse.jdt.internal.compiler.util.Util; > > public class Main implements ProblemSeverities, SuffixConstants { >@@ -3076,130 +3078,140 @@ > ArrayList currentRuleSpecs = new ArrayList(defaultSize); > StringTokenizer tokenizer = new StringTokenizer(currentPath, > File.pathSeparator + "[]", true); //$NON-NLS-1$ >+ LinkedList list = new LinkedList(Collections.list(tokenizer)); >+ > // state machine >- final int start = 0; >- final int readyToClose = 1; >- // 'path' 'path1[rule];path2' >- final int readyToCloseEndingWithRules = 2; >- // 'path[rule]' 'path1;path2[rule]' >- final int readyToCloseOrOtherEntry = 3; >- // 'path[rule];' 'path;' 'path1;path2;' >- final int rulesNeedAnotherRule = 4; >- // 'path[rule1;' >- final int rulesStart = 5; >- // 'path[' 'path1;path2[' >- final int rulesReadyToClose = 6; >- // 'path[rule' 'path[rule1;rule2' >- final int destinationPathReadyToClose = 7; >- // 'path[-d bin' >- final int readyToCloseEndingWithDestinationPath = 8; >- // 'path[-d bin]' 'path[rule][-d bin]' >- final int destinatonPathStart = 9; >- // 'path[rule][' >+ // process list in reverse order, start refers to end of list >+ final int start = 0; >+ final int rulesStart = 1; >+ // // '][-d bin]' '][-d bin]:path' >+ final int rulesReadyToCloseOrOtherRule = 2; >+ // 'rule]' 'rule1:rule2]' >+ final int rulesNeedAnotherRule = 3; >+ // ':rule2]' ':rule2:rule3]:path' >+ final int readyForPath = 4; >+ // '[rule]' '[rule1:rule2]' '[rule][-d bin] >+ final int readyToCloseOrOtherEntry = 5; >+ // 'path[rule]' 'path' 'path1:path2' 'path[-d bin]' path[rule][-d bin] >+ final int readyForPathOrRules = 6; >+ // ':path[rule]' ':path' >+ final int rulesOrDestinationStart = 7; >+ // ']' ']:path' >+ final int destinationPathReadyToClose = 8; >+ // // '-d bin]' '-d bin]:path' >+ final int readyForPathOrRulesWithDestination = 9; >+ // '[-d bin]' '[-d bin]:path' > final int error = 99; > int state = start; >+ >+ if (((String)list.getFirst()).equalsIgnoreCase(File.pathSeparator)) { >+ list.removeFirst(); >+ } > String token = null; >- while (tokenizer.hasMoreTokens() && state != error) { >- token = tokenizer.nextToken(); >+ while (!list.isEmpty() && state != error) { >+ token = (String)list.removeLast(); > if (token.equals(File.pathSeparator)) { > switch (state) { > case start: >- case readyToCloseOrOtherEntry: >+ case rulesNeedAnotherRule: >+ case readyForPathOrRules: > break; >- case readyToClose: >- case readyToCloseEndingWithRules: >- case readyToCloseEndingWithDestinationPath: >- state = readyToCloseOrOtherEntry; >+ case readyToCloseOrOtherEntry: >+ Collections.reverse(currentRuleSpecs); > addNewEntry(paths, currentClasspathName, currentRuleSpecs, > customEncoding, currentDestinationPath, isSourceOnly, > rejectDestinationPathOnJars); > currentRuleSpecs.clear(); >+ currentDestinationPath = null; >+ currentClasspathName = null; >+ state = readyForPathOrRules; > break; >- case rulesReadyToClose: >+ case rulesReadyToCloseOrOtherRule: > state = rulesNeedAnotherRule; > break; >- case destinationPathReadyToClose: >- throw new InvalidInputException( >- this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ >- currentPath)); > default: > state = error; > } > } else if (token.equals("[")) { //$NON-NLS-1$ > switch (state) { >- case readyToClose: >- state = rulesStart; >- break; >- case readyToCloseEndingWithRules: >- state = destinatonPathStart; >+ case rulesReadyToCloseOrOtherRule: >+ state = readyForPath; > break; >- case readyToCloseEndingWithDestinationPath: >- state = rulesStart; >+ case destinationPathReadyToClose: >+ state = readyForPathOrRulesWithDestination; > break; >- default: >+ default: > state = error; > } > } else if (token.equals("]")) { //$NON-NLS-1$ > switch (state) { >- case rulesReadyToClose: >- state = readyToCloseEndingWithRules; >+ case start: >+ case readyForPathOrRules: >+ state = rulesOrDestinationStart; > break; >- case destinationPathReadyToClose: >- state = readyToCloseEndingWithDestinationPath; >+ case readyForPathOrRulesWithDestination: >+ state = rulesStart; > break; > default: >+ // give a useful error message if we can >+ if (list.size() > 2) { >+ if (((String)list.getLast()).startsWith("-d ") //$NON-NLS-1$ >+ && ((String)list.get(list.size()-2)).equalsIgnoreCase("[")) { //$NON-NLS-1$ >+ throw new InvalidInputException( >+ this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$ >+ currentPath)); >+ } >+ } > state = error; > } > } else { > // regular word > switch (state) { > case start: >- case readyToCloseOrOtherEntry: >- state = readyToClose; >- currentClasspathName = token; >+ case readyForPath: >+ case readyForPathOrRules: >+ case readyForPathOrRulesWithDestination: >+ currentClasspathName = getPath(list, token); >+ state = readyToCloseOrOtherEntry; >+ break; >+ case rulesOrDestinationStart: >+ if (token.startsWith("-d ")) { //$NON-NLS-1$ >+ currentDestinationPath = token.substring(3).trim(); >+ state = destinationPathReadyToClose; >+ } else { >+ currentRuleSpecs.add(token); >+ state = rulesReadyToCloseOrOtherRule; >+ } > break; > case rulesStart: >+ case rulesNeedAnotherRule: > if (token.startsWith("-d ")) { //$NON-NLS-1$ > if (currentDestinationPath != null) { > throw new InvalidInputException( > this.bind("configure.duplicateDestinationPathEntry", //$NON-NLS-1$ > currentPath)); >- } >- currentDestinationPath = token.substring(3).trim(); >- state = destinationPathReadyToClose; >- break; >- } // else we proceed with a rule >- case rulesNeedAnotherRule: >- if (currentDestinationPath != null) { >- throw new InvalidInputException( >- this.bind("configure.accessRuleAfterDestinationPath", //$NON-NLS-1$ >+ } else { >+ throw new InvalidInputException( >+ this.bind("configure.incorrectDestinationPathEntry", //$NON-NLS-1$ > currentPath)); >+ } > } >- state = rulesReadyToClose; > currentRuleSpecs.add(token); >- break; >- case destinatonPathStart: >- if (!token.startsWith("-d ")) { //$NON-NLS-1$ >- state = error; >- } else { >- currentDestinationPath = token.substring(3).trim(); >- state = destinationPathReadyToClose; >- } >+ state = rulesReadyToCloseOrOtherRule; > break; > default: > state = error; > } > } > } >+ > switch(state) { >+ case readyForPathOrRules: > case readyToCloseOrOtherEntry: >- break; >- case readyToClose: >- case readyToCloseEndingWithRules: >- case readyToCloseEndingWithDestinationPath: >+ Collections.reverse(currentRuleSpecs); > addNewEntry(paths, currentClasspathName, currentRuleSpecs, >- customEncoding, currentDestinationPath, isSourceOnly, >- rejectDestinationPathOnJars); >+ customEncoding, currentDestinationPath, isSourceOnly, >+ rejectDestinationPathOnJars); > break; > default : > // we go on anyway >@@ -3209,6 +3221,15 @@ > } > } > >+private String getPath(LinkedList list, String path) { >+ while (!list.isEmpty()) { >+ if (File.pathSeparator.equalsIgnoreCase((String)list.getLast())) >+ break; >+ path = (String)list.removeLast() + path; >+ } >+ return path; >+} >+ > private int processPaths(String[] args, int index, String currentArg, ArrayList paths) throws InvalidInputException { > int localIndex = index; > int count = 0; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.97 >diff -u -r1.97 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 20 Dec 2006 16:11:25 -0000 1.97 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 29 Jan 2007 04:54:32 -0000 >@@ -4668,6 +4668,36 @@ > true); > } > >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=161996 >+public void test107(){ >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "/** */\n" + >+ "public class X {\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "X.java\"" >+ + " -cp " + "\"" + OUTPUT_DIR + File.separator + "[squarebracket].jar" + "\"" >+ + " -d \"" + OUTPUT_DIR + "\"", >+ "", >+ "", >+ true); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "/** */\n" + >+ "public class X {\n" + >+ "}", >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "X.java\"" >+ + " -cp " + "\"" + OUTPUT_DIR + File.separator + "[square][bracket].jar" + "\"" >+ + " -d \"" + OUTPUT_DIR + "\"", >+ "", >+ "", >+ true); >+} >+ > public static Class testClass() { > return BatchCompilerTest.class; > }
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 161996
:
52549
|
52550
|
57640
|
57641
| 57669 |
57670
|
57722
|
57723
|
58003