View | Details | Raw Unified | Return to bug 213692
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java (+187 lines)
Lines 548-553 Link Here
548
		false,
548
		false,
549
		true);	
549
		true);	
550
}
550
}
551
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=213692
552
public void test018() {
553
	Map customOptions = getCompilerOptions();
554
	customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
555
	this.runNegativeTest(
556
		new String[] {
557
			"X.java",
558
			"public class X {\n" +
559
			"	#\n" +
560
			"	String s1= \"1\"; //$NON-NLS-1$\n" +
561
			"	public void foo() {\n" +
562
			"		String s2= \"2\"; //$NON-NLS-1$\n" +
563
			"	}\n" +
564
			"}",
565
		}, 
566
		"----------\n" + 
567
		"1. ERROR in X.java (at line 2)\n" + 
568
		"	#\n" + 
569
		"	^\n" + 
570
		"Syntax error on token \"Invalid Character\", delete this token\n" + 
571
		"----------\n",
572
		null,
573
		true,
574
		customOptions,
575
		false,
576
		false,
577
		false,
578
		false,
579
		true);	
580
}
581
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=213692
582
public void test019() {
583
	Map customOptions = getCompilerOptions();
584
	customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
585
	this.runNegativeTest(
586
		new String[] {
587
			"X.java",
588
			"public class X {\n" +
589
			"	String s1= \"1\"; //$NON-NLS-1$\n" +
590
			"	#\n" +
591
			"	public void foo() {\n" +
592
			"		String s2= \"2\"; //$NON-NLS-1$\n" +
593
			"	}\n" +
594
			"}",
595
		}, 
596
		"----------\n" + 
597
		"1. ERROR in X.java (at line 3)\n" + 
598
		"	#\n" + 
599
		"	^\n" + 
600
		"Syntax error on token \"Invalid Character\", delete this token\n" + 
601
		"----------\n",
602
		null,
603
		true,
604
		customOptions,
605
		false,
606
		false,
607
		false,
608
		false,
609
		true);	
610
}
611
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=213692
612
public void test020() {
613
	Map customOptions = getCompilerOptions();
614
	customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
615
	this.runNegativeTest(
616
		new String[] {
617
			"X.java",
618
			"public class X {\n" +
619
			"	String s1= \"1\"; //$NON-NLS-1$\n" +
620
			"	public void foo() {\n" +
621
			"		#\n" +
622
			"		String s2= \"2\"; //$NON-NLS-1$\n" +
623
			"	}\n" +
624
			"}",
625
		}, 
626
		"----------\n" + 
627
		"1. ERROR in X.java (at line 4)\n" + 
628
		"	#\n" + 
629
		"	^\n" + 
630
		"Syntax error on token \"Invalid Character\", delete this token\n" + 
631
		"----------\n",
632
		null,
633
		true,
634
		customOptions,
635
		false,
636
		false,
637
		false,
638
		false,
639
		true);	
640
}
641
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=213692
642
public void test021() {
643
	Map customOptions = getCompilerOptions();
644
	customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
645
	this.runNegativeTest(
646
		new String[] {
647
			"X.java",
648
			"public class X {\n" +
649
			"	String s1= \"1\"; //$NON-NLS-1$\n" +
650
			"	public void foo() {\n" +
651
			"		String s2= \"2\"; //$NON-NLS-1$\n" +
652
			"		#\n" +
653
			"	}\n" +
654
			"}",
655
		}, 
656
		"----------\n" + 
657
		"1. ERROR in X.java (at line 5)\n" + 
658
		"	#\n" + 
659
		"	^\n" + 
660
		"Syntax error on token \"Invalid Character\", delete this token\n" + 
661
		"----------\n",
662
		null,
663
		true,
664
		customOptions,
665
		false,
666
		false,
667
		false,
668
		false,
669
		true);	
670
}
671
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=213692
672
public void test022() {
673
	Map customOptions = getCompilerOptions();
674
	customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
675
	this.runNegativeTest(
676
		new String[] {
677
			"X.java",
678
			"public class X {\n" +
679
			"	#\n" +
680
			"	String s1= \"1\"; //$NON-NLS-1$\n" +
681
			"	public void foo() {\n" +
682
			"		#\n" +
683
			"		String s2= \"2\"; //$NON-NLS-1$\n" +
684
			"	}\n" +
685
			"}",
686
		}, 
687
		"----------\n" + 
688
		"1. ERROR in X.java (at line 2)\n" + 
689
		"	#\n" + 
690
		"	^\n" + 
691
		"Syntax error on token \"Invalid Character\", delete this token\n" + 
692
		"----------\n" + 
693
		"2. ERROR in X.java (at line 5)\n" + 
694
		"	#\n" + 
695
		"	^\n" + 
696
		"Syntax error on token \"Invalid Character\", delete this token\n" + 
697
		"----------\n",
698
		null,
699
		true,
700
		customOptions,
701
		false,
702
		false,
703
		false,
704
		false,
705
		true);	
706
}
707
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=213692
708
public void test023() {
709
	Map customOptions = getCompilerOptions();
710
	customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
711
	this.runNegativeTest(
712
		new String[] {
713
			"X.java",
714
			"public class X {\n" + 
715
			"        public String toString() {\n" + 
716
			"                StringBuffer output = new StringBuffer(10);\n" + 
717
			"                output.append(this != null) ? null : \"<no type>\"); //$NON-NLS-1$\n" + 
718
			"                output.append(\" \"); //$NON-NLS-1$\n" + 
719
			"                return output.toString();\n" + 
720
			"        }       \n" + 
721
			"}",
722
		}, 
723
		"----------\n" + 
724
		"1. ERROR in X.java (at line 4)\n" + 
725
		"	output.append(this != null) ? null : \"<no type>\"); //$NON-NLS-1$\n" + 
726
		"	                          ^\n" + 
727
		"Syntax error on token \")\", delete this token\n" + 
728
		"----------\n",
729
		null,
730
		true,
731
		customOptions,
732
		false,
733
		false,
734
		false,
735
		false,
736
		true);	
737
}
551
public static Class testClass() {
738
public static Class testClass() {
552
	return ExternalizeStringLiteralsTest.class;
739
	return ExternalizeStringLiteralsTest.class;
553
}
740
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java (-1 / +16 lines)
Lines 34-39 Link Here
34
import org.eclipse.jdt.internal.compiler.problem.AbortType;
34
import org.eclipse.jdt.internal.compiler.problem.AbortType;
35
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
35
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
36
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
36
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
37
import org.eclipse.jdt.internal.compiler.util.HashSetOfInt;
37
38
38
public class CompilationUnitDeclaration
39
public class CompilationUnitDeclaration
39
	extends ASTNode
40
	extends ASTNode
Lines 69-74 Link Here
69
	public NLSTag[] nlsTags;
70
	public NLSTag[] nlsTags;
70
	private StringLiteral[] stringLiterals;
71
	private StringLiteral[] stringLiterals;
71
	private int stringLiteralsPtr;
72
	private int stringLiteralsPtr;
73
	private HashSetOfInt stringLiteralsStart;
72
74
73
	long[] suppressWarningIrritants;  // irritant for suppressed warnings
75
	long[] suppressWarningIrritants;  // irritant for suppressed warnings
74
	Annotation[] suppressWarningAnnotations;
76
	Annotation[] suppressWarningAnnotations;
Lines 434-440 Link Here
434
		}
436
		}
435
	}
437
	}
436
438
437
	public void recordStringLiteral(StringLiteral literal) {
439
	public void recordStringLiteral(StringLiteral literal, boolean fromRecovery) {
440
		if (this.stringLiteralsStart != null) {
441
			if (this.stringLiteralsStart.contains(literal.sourceStart)) return;
442
			this.stringLiteralsStart.add(literal.sourceStart);
443
		} else if (fromRecovery) {
444
			this.stringLiteralsStart = new HashSetOfInt(stringLiteralsPtr + STRING_LITERALS_INCREMENT);
445
			for (int i = 0; i < this.stringLiteralsPtr; i++) {
446
				this.stringLiteralsStart.add(this.stringLiterals[i].sourceStart);
447
			}
448
			
449
			if (this.stringLiteralsStart.contains(literal.sourceStart)) return;
450
			this.stringLiteralsStart.add(literal.sourceStart);
451
		}
452
		
438
		if (this.stringLiterals == null) {
453
		if (this.stringLiterals == null) {
439
			this.stringLiterals = new StringLiteral[STRING_LITERALS_INCREMENT];
454
			this.stringLiterals = new StringLiteral[STRING_LITERALS_INCREMENT];
440
			this.stringLiteralsPtr = 0;
455
			this.stringLiteralsPtr = 0;
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-7 / +40 lines)
Lines 183-188 Link Here
183
	public boolean reportSyntaxErrorIsRequired = true;
183
	public boolean reportSyntaxErrorIsRequired = true;
184
	protected boolean restartRecovery;
184
	protected boolean restartRecovery;
185
	
185
	
186
	protected int lastPosistion;
187
	
186
	// statement recovery
188
	// statement recovery
187
//	public boolean statementRecoveryEnabled = true;
189
//	public boolean statementRecoveryEnabled = true;
188
	public boolean methodRecoveryActivated = false;
190
	public boolean methodRecoveryActivated = false;
Lines 7442-7454 Link Here
7442
			break;
7444
			break;
7443
		case TokenNameStringLiteral :
7445
		case TokenNameStringLiteral :
7444
			StringLiteral stringLiteral;
7446
			StringLiteral stringLiteral;
7445
			if (this.recordStringLiterals && this.checkExternalizeStrings && !this.statementRecoveryActivated) {
7447
			if (this.recordStringLiterals &&
7448
					this.checkExternalizeStrings &&
7449
					this.lastPosistion < this.scanner.currentPosition &&
7450
					!this.statementRecoveryActivated) {
7446
				stringLiteral = this.createStringLiteral(
7451
				stringLiteral = this.createStringLiteral(
7447
					this.scanner.getCurrentTokenSourceString(), 
7452
					this.scanner.getCurrentTokenSourceString(), 
7448
					this.scanner.startPosition, 
7453
					this.scanner.startPosition, 
7449
					this.scanner.currentPosition - 1,
7454
					this.scanner.currentPosition - 1,
7450
					Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr));
7455
					Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr));
7451
				this.compilationUnit.recordStringLiteral(stringLiteral);
7456
				this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null);
7452
			} else {
7457
			} else {
7453
				stringLiteral = this.createStringLiteral(
7458
				stringLiteral = this.createStringLiteral(
7454
					this.scanner.getCurrentTokenSourceString(), 
7459
					this.scanner.getCurrentTokenSourceString(), 
Lines 8787-8792 Link Here
8787
	final boolean checkNLS = this.options.getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore;
8792
	final boolean checkNLS = this.options.getSeverity(CompilerOptions.NonExternalizedString) != ProblemSeverities.Ignore;
8788
	this.checkExternalizeStrings = checkNLS;
8793
	this.checkExternalizeStrings = checkNLS;
8789
	this.scanner.checkNonExternalizedStringLiterals = initializeNLS && checkNLS;
8794
	this.scanner.checkNonExternalizedStringLiterals = initializeNLS && checkNLS;
8795
	this.scanner.lastPosistion = -1;
8790
8796
8791
	resetModifiers();
8797
	resetModifiers();
8792
8798
Lines 8802-8807 Link Here
8802
	this.lastJavadocEnd = -1;
8808
	this.lastJavadocEnd = -1;
8803
	this.listLength = 0;
8809
	this.listLength = 0;
8804
	this.listTypeParameterLength = 0;
8810
	this.listTypeParameterLength = 0;
8811
	this.lastPosistion = -1;
8805
	
8812
	
8806
	this.rBraceStart = 0;
8813
	this.rBraceStart = 0;
8807
	this.rBraceEnd = 0;
8814
	this.rBraceEnd = 0;
Lines 9125-9131 Link Here
9125
			
9132
			
9126
		} else if (act > ERROR_ACTION) { /* shift-reduce */
9133
		} else if (act > ERROR_ACTION) { /* shift-reduce */
9127
			consumeToken(this.currentToken);
9134
			consumeToken(this.currentToken);
9128
			if (this.currentElement != null) this.recoveryTokenCheck();
9135
			if (this.currentElement != null) {
9136
				boolean oldValue = this.recordStringLiterals;
9137
				this.recordStringLiterals = false;
9138
				this.recoveryTokenCheck();
9139
				this.recordStringLiterals = oldValue;
9140
			}
9129
			try {
9141
			try {
9130
				this.currentToken = this.scanner.getNextToken();
9142
				this.currentToken = this.scanner.getNextToken();
9131
			} catch(InvalidInputException e){
9143
			} catch(InvalidInputException e){
Lines 9148-9154 Link Here
9148
		} else {
9160
		} else {
9149
		    if (act < ACCEPT_ACTION) { /* shift */
9161
		    if (act < ACCEPT_ACTION) { /* shift */
9150
				consumeToken(this.currentToken);
9162
				consumeToken(this.currentToken);
9151
				if (this.currentElement != null) this.recoveryTokenCheck();
9163
				if (this.currentElement != null) {
9164
					boolean oldValue = this.recordStringLiterals;
9165
					this.recordStringLiterals = false;
9166
					this.recoveryTokenCheck();
9167
					this.recordStringLiterals = oldValue;
9168
				}
9152
				try{
9169
				try{
9153
					this.currentToken = this.scanner.getNextToken();
9170
					this.currentToken = this.scanner.getNextToken();
9154
				} catch(InvalidInputException e){
9171
				} catch(InvalidInputException e){
Lines 10059-10064 Link Here
10059
 */
10076
 */
10060
public void recoveryTokenCheck() {
10077
public void recoveryTokenCheck() {
10061
	switch (this.currentToken) {
10078
	switch (this.currentToken) {
10079
		case TokenNameStringLiteral :
10080
			if (this.recordStringLiterals &&
10081
					this.checkExternalizeStrings &&
10082
					this.lastPosistion < this.scanner.currentPosition &&
10083
					!this.statementRecoveryActivated) {
10084
				StringLiteral stringLiteral = this.createStringLiteral(
10085
					this.scanner.getCurrentTokenSourceString(), 
10086
					this.scanner.startPosition, 
10087
					this.scanner.currentPosition - 1,
10088
					Util.getLineNumber(this.scanner.startPosition, this.scanner.lineEnds, 0, this.scanner.linePtr));
10089
				this.compilationUnit.recordStringLiteral(stringLiteral, this.currentElement != null);
10090
			}
10091
			break;
10062
		case TokenNameLBRACE : 
10092
		case TokenNameLBRACE : 
10063
			RecoveredElement newElement = null;
10093
			RecoveredElement newElement = null;
10064
			if(!this.ignoreNextOpeningBrace) {
10094
			if(!this.ignoreNextOpeningBrace) {
Lines 10246-10254 Link Here
10246
		return false;
10276
		return false;
10247
	}
10277
	}
10248
}
10278
}
10249
protected boolean resumeOnSyntaxError() {
10279
protected boolean resumeOnSyntaxError() {	
10250
	this.checkExternalizeStrings = false;
10251
	this.scanner.checkNonExternalizedStringLiterals = false;
10252
	/* request recovery initialization */
10280
	/* request recovery initialization */
10253
	if (this.currentElement == null){
10281
	if (this.currentElement == null){
10254
		// Reset javadoc before restart parsing after recovery
10282
		// Reset javadoc before restart parsing after recovery
Lines 10270-10275 Link Here
10270
	/* update recovery state with current error state of the parser */
10298
	/* update recovery state with current error state of the parser */
10271
	this.updateRecoveryState();
10299
	this.updateRecoveryState();
10272
	
10300
	
10301
	if (this.lastPosistion < this.scanner.currentPosition) {
10302
		this.lastPosistion = this.scanner.currentPosition;
10303
		this.scanner.lastPosistion = this.scanner.currentPosition;
10304
	}
10305
	
10273
	/* attempt to reset state in order to resume to parse loop */
10306
	/* attempt to reset state in order to resume to parse loop */
10274
	return this.resumeAfterRecovery();
10307
	return this.resumeAfterRecovery();
10275
}
10308
}
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java (-4 / +10 lines)
Lines 157-162 Link Here
157
	protected int nlsTagsPtr;
157
	protected int nlsTagsPtr;
158
	public boolean checkNonExternalizedStringLiterals;
158
	public boolean checkNonExternalizedStringLiterals;
159
	
159
	
160
	protected int lastPosistion;
161
	
160
	// generic support
162
	// generic support
161
	public boolean returnOnlyGreater = false;
163
	public boolean returnOnlyGreater = false;
162
	
164
	
Lines 1507-1513 Link Here
1507
								recordComment(TokenNameCOMMENT_LINE);
1509
								recordComment(TokenNameCOMMENT_LINE);
1508
								if (this.taskTags != null) checkTaskTag(this.startPosition, this.currentPosition);
1510
								if (this.taskTags != null) checkTaskTag(this.startPosition, this.currentPosition);
1509
								if ((this.currentCharacter == '\r') || (this.currentCharacter == '\n')) {
1511
								if ((this.currentCharacter == '\r') || (this.currentCharacter == '\n')) {
1510
									if (this.checkNonExternalizedStringLiterals) {
1512
									if (this.checkNonExternalizedStringLiterals &&
1513
											this.lastPosistion < this.currentPosition) {
1511
										parseTags();
1514
										parseTags();
1512
									}
1515
									}
1513
									if (this.recordLineSeparator) {
1516
									if (this.recordLineSeparator) {
Lines 1525-1531 Link Here
1525
								this.currentPosition--;
1528
								this.currentPosition--;
1526
								recordComment(TokenNameCOMMENT_LINE);
1529
								recordComment(TokenNameCOMMENT_LINE);
1527
								if (this.taskTags != null) checkTaskTag(this.startPosition, this.currentPosition);
1530
								if (this.taskTags != null) checkTaskTag(this.startPosition, this.currentPosition);
1528
								if (this.checkNonExternalizedStringLiterals) {
1531
								if (this.checkNonExternalizedStringLiterals &&
1532
										this.lastPosistion < this.currentPosition) {
1529
									parseTags();
1533
									parseTags();
1530
								}
1534
								}
1531
								if (this.tokenizeComments) {
1535
								if (this.tokenizeComments) {
Lines 1951-1957 Link Here
1951
								recordComment(TokenNameCOMMENT_LINE);
1955
								recordComment(TokenNameCOMMENT_LINE);
1952
								if (this.recordLineSeparator
1956
								if (this.recordLineSeparator
1953
									&& ((this.currentCharacter == '\r') || (this.currentCharacter == '\n'))) {
1957
									&& ((this.currentCharacter == '\r') || (this.currentCharacter == '\n'))) {
1954
										if (this.checkNonExternalizedStringLiterals) {
1958
										if (this.checkNonExternalizedStringLiterals &&
1959
												this.lastPosistion < this.currentPosition) {
1955
											parseTags();
1960
											parseTags();
1956
										}
1961
										}
1957
										if (this.recordLineSeparator) {
1962
										if (this.recordLineSeparator) {
Lines 1966-1972 Link Here
1966
								 //an eof will then be generated
1971
								 //an eof will then be generated
1967
								this.currentPosition--;
1972
								this.currentPosition--;
1968
								recordComment(TokenNameCOMMENT_LINE);
1973
								recordComment(TokenNameCOMMENT_LINE);
1969
								if (this.checkNonExternalizedStringLiterals) {
1974
								if (this.checkNonExternalizedStringLiterals &&
1975
										this.lastPosistion < this.currentPosition) {
1970
									parseTags();
1976
									parseTags();
1971
								}
1977
								}
1972
								if (!this.tokenizeComments) {
1978
								if (!this.tokenizeComments) {
(-)compiler/org/eclipse/jdt/internal/compiler/util/HashSetOfInt.java (+129 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.util;
12
13
/**
14
 * HashSet of Object[]
15
 */
16
public final class HashSetOfInt implements Cloneable {
17
	
18
	// to avoid using Enumerations, walk the individual tables skipping nulls
19
	public int[] set;
20
21
	public int elementSize; // number of elements in the table
22
	int threshold;
23
24
	public HashSetOfInt() {
25
		this(13);
26
	}
27
28
	public HashSetOfInt(int size) {
29
30
		this.elementSize = 0;
31
		this.threshold = size; // size represents the expected number of elements
32
		int extraRoom = (int) (size * 1.75f);
33
		if (this.threshold == extraRoom)
34
			extraRoom++;
35
		this.set = new int[extraRoom];
36
	}
37
38
	public Object clone() throws CloneNotSupportedException {
39
		HashSetOfInt result = (HashSetOfInt) super.clone();
40
		result.elementSize = this.elementSize;
41
		result.threshold = this.threshold;
42
43
		int length = this.set.length;
44
		result.set = new int[length];
45
		System.arraycopy(this.set, 0, result.set, 0, length);
46
47
		return result;
48
	}
49
50
	public boolean contains(int element) {
51
		int length = this.set.length;
52
		int index = element % length;
53
		int currentElement;
54
		while ((currentElement = this.set[index]) != 0) {
55
			if (currentElement == element)
56
				return true;
57
			if (++index == length) {
58
				index = 0;
59
			}
60
		}
61
		return false;
62
	}
63
	
64
	public int add(int element) {
65
		int length = this.set.length;
66
		int index = element % length;
67
		int currentElement;
68
		while ((currentElement = this.set[index]) != 0) {
69
			if (currentElement == element)
70
				return this.set[index] = element;
71
			if (++index == length) {
72
				index = 0;
73
			}
74
		}
75
		this.set[index] = element;
76
77
		// assumes the threshold is never equal to the size of the table
78
		if (++this.elementSize > threshold)
79
			rehash();
80
		return element;
81
	}
82
83
	public int remove(int element) {
84
		int length = this.set.length;
85
		int index = element % length;
86
		int currentElement;
87
		while ((currentElement = this.set[index]) != 0) {
88
			if (currentElement == element) {
89
				int existing = this.set[index];
90
				this.elementSize--;
91
				this.set[index] = 0;
92
				rehash();
93
				return existing;
94
			}
95
			if (++index == length) {
96
				index = 0;
97
			}
98
		}
99
		return 0;
100
	}
101
102
	private void rehash() {
103
104
		HashSetOfInt newHashSet = new HashSetOfInt(elementSize * 2);		// double the number of expected elements
105
		int currentElement;
106
		for (int i = this.set.length; --i >= 0;)
107
			if ((currentElement = this.set[i]) != 0)
108
				newHashSet.add(currentElement);
109
110
		this.set = newHashSet.set;
111
		this.threshold = newHashSet.threshold;
112
	}
113
114
	public int size() {
115
		return elementSize;
116
	}
117
118
	public String toString() {
119
		StringBuffer buffer = new StringBuffer();
120
		int element;
121
		for (int i = 0, length = this.set.length; i < length; i++)
122
			if ((element = this.set[i]) != 0) {
123
				buffer.append(element);
124
				if (i != length-1)
125
					buffer.append('\n');
126
			}
127
		return buffer.toString();
128
	}
129
}

Return to bug 213692