View | Details | Raw Unified | Return to bug 161996 | Differences between
and this patch

Collapse All | Expand All

(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-35 / +64 lines)
Lines 28-36 Link Here
28
import java.text.MessageFormat;
28
import java.text.MessageFormat;
29
import java.util.ArrayList;
29
import java.util.ArrayList;
30
import java.util.Arrays;
30
import java.util.Arrays;
31
import java.util.Collections;
31
import java.util.Date;
32
import java.util.Date;
32
import java.util.HashMap;
33
import java.util.HashMap;
33
import java.util.Iterator;
34
import java.util.Iterator;
35
import java.util.LinkedList;
34
import java.util.Locale;
36
import java.util.Locale;
35
import java.util.Map;
37
import java.util.Map;
36
import java.util.MissingResourceException;
38
import java.util.MissingResourceException;
Lines 40-47 Link Here
40
42
41
import org.eclipse.jdt.core.compiler.CategorizedProblem;
43
import org.eclipse.jdt.core.compiler.CategorizedProblem;
42
import org.eclipse.jdt.core.compiler.CharOperation;
44
import org.eclipse.jdt.core.compiler.CharOperation;
43
import org.eclipse.jdt.core.compiler.InvalidInputException;
44
import org.eclipse.jdt.core.compiler.IProblem;
45
import org.eclipse.jdt.core.compiler.IProblem;
46
import org.eclipse.jdt.core.compiler.InvalidInputException;
45
import org.eclipse.jdt.internal.compiler.ClassFile;
47
import org.eclipse.jdt.internal.compiler.ClassFile;
46
import org.eclipse.jdt.internal.compiler.CompilationResult;
48
import org.eclipse.jdt.internal.compiler.CompilationResult;
47
import org.eclipse.jdt.internal.compiler.Compiler;
49
import org.eclipse.jdt.internal.compiler.Compiler;
Lines 59-67 Link Here
59
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
61
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
60
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
62
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
61
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
63
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
64
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
62
import org.eclipse.jdt.internal.compiler.util.Messages;
65
import org.eclipse.jdt.internal.compiler.util.Messages;
63
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
66
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
64
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
65
import org.eclipse.jdt.internal.compiler.util.Util;
67
import org.eclipse.jdt.internal.compiler.util.Util;
66
68
67
public class Main implements ProblemSeverities, SuffixConstants {
69
public class Main implements ProblemSeverities, SuffixConstants {
Lines 2989-3044 Link Here
2989
	ArrayList currentRuleSpecs = new ArrayList(defaultSize);
2991
	ArrayList currentRuleSpecs = new ArrayList(defaultSize);
2990
	StringTokenizer tokenizer = new StringTokenizer(currentPath,
2992
	StringTokenizer tokenizer = new StringTokenizer(currentPath,
2991
			File.pathSeparator + "[]", true); //$NON-NLS-1$
2993
			File.pathSeparator + "[]", true); //$NON-NLS-1$
2994
	LinkedList list = new LinkedList(Collections.list(tokenizer));
2995
	
2992
	// state machine
2996
	// state machine
2993
	final int start = 0; 
2997
	// process list in reverse order, start refers to end of list
2994
	final int readyToClose = 1;
2998
	final int start = 0;
2995
	// 'path' 'path1[rule];path2'
2999
	final int rulesStart = 1;
2996
	final int readyToCloseEndingWithRules = 2;
3000
	// ']' '];path'
2997
	// 'path[rule]' 'path1;path2[rule]'
3001
	final int rulesReadyToCloseOrOtherRule = 2;
2998
	final int readyToCloseOrOtherEntry = 3;
3002
	// 'rule]' 'rule1;rule2]'
2999
	// 'path[rule];' 'path;' 'path1;path2;'
3003
	final int rulesNeedAnotherRule = 3;
3000
	final int rulesNeedAnotherRule = 4;
3004
	// ';rule2]' ';rule2;rule3];path'
3001
	// 'path[rule1;'
3005
	final int readyForPath = 4;
3002
	final int rulesStart = 5;
3006
	// '[rule]' '[rule1;rule2]'
3003
	// 'path[' 'path1;path2['
3007
	final int readyToCloseOrOtherEntry = 5;
3004
	final int rulesReadyToClose = 6;
3008
	// 'path[rule]' 'path' 'path1;path2'
3005
	// 'path[rule' 'path[rule1;rule2'
3009
	final int readyForPathOrRules = 6;
3010
	// ';path[rule]' ';path'
3006
	final int error = 99;
3011
	final int error = 99;
3007
	int state = start;
3012
	int state = start;
3013
3008
	String token = null;
3014
	String token = null;
3009
	while (tokenizer.hasMoreTokens()) {
3015
	while (!list.isEmpty()) {
3010
		token = tokenizer.nextToken();
3016
		token = (String)list.removeLast();
3011
		if (token.equals(File.pathSeparator)) {
3017
		if (token.equals(File.pathSeparator)) {
3012
			switch (state) {
3018
			switch (state) {
3013
			case start:
3019
			case start:
3014
				break;
3020
				break;
3015
			case readyToClose:
3016
			case readyToCloseEndingWithRules:
3017
			case readyToCloseOrOtherEntry:
3021
			case readyToCloseOrOtherEntry:
3018
				state = readyToCloseOrOtherEntry;
3019
				addNewEntry(paths, currentClasspathName, currentRuleSpecs, customEncoding, isSourceOnly);
3022
				addNewEntry(paths, currentClasspathName, currentRuleSpecs, customEncoding, isSourceOnly);
3020
				currentRuleSpecs.clear();
3023
				currentRuleSpecs.clear();
3024
				state = readyForPathOrRules;
3021
				break;
3025
				break;
3022
			case rulesReadyToClose:
3026
			case rulesReadyToCloseOrOtherRule:
3023
				state = rulesNeedAnotherRule;
3027
				state = rulesNeedAnotherRule;
3024
				break;
3028
				break;
3029
			case rulesNeedAnotherRule:
3030
				break;
3031
			case readyForPathOrRules:
3032
				break;
3025
			default:
3033
			default:
3026
				state = error;
3034
				state = error;
3027
			}
3035
			}
3028
		} else if (token.equals("[")) { //$NON-NLS-1$
3036
		} else if (token.equals("[")) { //$NON-NLS-1$
3029
			switch (state) {
3037
			switch (state) {
3030
			case readyToClose:
3038
			case start:
3031
				state = rulesStart;
3039
			case readyForPath:
3040
			case readyForPathOrRules:
3041
				currentClasspathName = getPath(list, token);
3042
				state = readyToCloseOrOtherEntry;
3032
				break;
3043
				break;
3033
			default:
3044
			case rulesReadyToCloseOrOtherRule:
3045
				state =  readyForPath;
3046
				break;
3047
			default:  
3034
				state = error;
3048
				state = error;
3035
			}
3049
			}
3036
		} else if (token.equals("]")) { //$NON-NLS-1$
3050
		} else if (token.equals("]")) { //$NON-NLS-1$
3037
			switch (state) {
3051
			switch (state) {
3038
			case rulesReadyToClose:
3052
			case start:
3039
				state = readyToCloseEndingWithRules;
3053
			case readyForPathOrRules:
3054
				state = rulesStart;
3040
				break;
3055
				break;
3041
			default:
3056
			case readyForPath:
3057
				currentClasspathName = getPath(list, token);
3058
				state = readyToCloseOrOtherEntry;
3059
				break;
3060
			default:  
3042
				state = error;
3061
				state = error;
3043
			}
3062
			}
3044
3063
Lines 3046-3069 Link Here
3046
			// regular word
3065
			// regular word
3047
			switch (state) {
3066
			switch (state) {
3048
			case start:
3067
			case start:
3049
			case readyToCloseOrOtherEntry:
3068
			case readyForPath:
3050
				state = readyToClose;
3069
			case readyForPathOrRules:
3051
				currentClasspathName = token;
3070
				currentClasspathName = getPath(list, token);
3071
				state = readyToCloseOrOtherEntry;
3052
				break;
3072
				break;
3053
			case rulesNeedAnotherRule:
3054
			case rulesStart:
3073
			case rulesStart:
3055
				state = rulesReadyToClose;
3074
			case rulesNeedAnotherRule:
3056
				currentRuleSpecs.add(token);
3075
				currentRuleSpecs.add(token);
3076
				state = rulesReadyToCloseOrOtherRule;
3057
				break;
3077
				break;
3058
			default:
3078
			default:
3059
				state = error;
3079
				state = error;
3060
			}
3080
			}
3061
		}
3081
		}
3062
	}
3082
	}
3083
3063
	switch(state) {
3084
	switch(state) {
3064
		case readyToClose :
3085
		case readyForPathOrRules:
3065
		case readyToCloseEndingWithRules :
3086
		case readyToCloseOrOtherEntry:
3066
		case readyToCloseOrOtherEntry :
3067
			addNewEntry(paths, currentClasspathName, currentRuleSpecs, customEncoding, isSourceOnly);
3087
			addNewEntry(paths, currentClasspathName, currentRuleSpecs, customEncoding, isSourceOnly);
3068
			break;
3088
			break;
3069
		default :
3089
		default :
Lines 3071-3074 Link Here
3071
			this.logger.logIncorrectClasspath(currentPath);
3091
			this.logger.logIncorrectClasspath(currentPath);
3072
	}
3092
	}
3073
}
3093
}
3094
3095
private String getPath(LinkedList list, String path) {
3096
	while (!list.isEmpty()) {
3097
		if (File.pathSeparator.equalsIgnoreCase((String)list.getLast()))
3098
			break;
3099
		path = (String)list.removeLast() + path;
3100
	}
3101
	return path;
3102
}
3074
}
3103
}

Return to bug 161996