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

(-)src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java (+1 lines)
Lines 55-60 Link Here
55
	standardTests.add(RuntimeTests.class);
55
	standardTests.add(RuntimeTests.class);
56
	standardTests.add(DebugAttributeTest.class);
56
	standardTests.add(DebugAttributeTest.class);
57
	standardTests.add(NullReferenceTest.class);
57
	standardTests.add(NullReferenceTest.class);
58
	standardTests.add(CompilerInvocationTests.class);
58
	
59
	
59
	// add all javadoc tests
60
	// add all javadoc tests
60
	for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) {
61
	for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (+72 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 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.core.tests.compiler.regression;
12
13
import java.util.HashMap;
14
import java.util.Map;
15
16
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
17
18
import junit.framework.Test;
19
20
/**
21
 * This class is meant to gather test cases related to the invocation of the
22
 * compiler, be it at an API or non API level.
23
 */
24
public class CompilerInvocationTests extends AbstractRegressionTest {
25
26
public CompilerInvocationTests(String name) {
27
    super(name);
28
}
29
30
	// Static initializer to specify tests subset using TESTS_* static variables
31
  	// All specified tests which does not belong to the class are skipped...
32
  	// Only the highest compliance level is run; add the VM argument
33
  	// -Dcompliance=1.4 (for example) to lower it if needed
34
  	static {
35
//    	TESTS_NAMES = new String[] { "test001" };
36
//    	TESTS_NUMBERS = new int[] { 1 };   
37
//    	TESTS_RANGE = new int[] { 1, -1 }; 
38
//  	TESTS_RANGE = new int[] { 1, 2049 }; 
39
//  	TESTS_RANGE = new int[] { 449, 451 }; 
40
//    	TESTS_RANGE = new int[] { 900, 999 }; 
41
  	}
42
43
public static Test suite() {
44
    return buildTestSuite(testClass());
45
}
46
  
47
public static Class testClass() {
48
    return CompilerInvocationTests.class;
49
}
50
51
// irritant vs warning token
52
public void test001_irritant_warning_token() {
53
	String [] tokens = new String[64];
54
	Map matcher = new HashMap();
55
	long irritant;
56
	String token;
57
	for (int i = 0; i < 64; i++) {
58
		if ((token = tokens[i] = CompilerOptions.warningTokenFromIrritant(irritant = 1L << i)) != null) {
59
			matcher.put(token, token);
60
			assertTrue((irritant & CompilerOptions.warningTokenToIrritant(token)) != 0);
61
		}
62
	}
63
	String [] allTokens = CompilerOptions.warningTokens;
64
	int length = allTokens.length;
65
	matcher.put("all", "all"); // all gets undetected in the From/To loop
66
	assertEquals(allTokens.length, matcher.size());
67
	for (int i = 0; i < length; i++) {
68
		assertNotNull(matcher.get(allTokens[i]));
69
	}
70
}
71
  
72
}
(-)buildnotes_jdt-core.html (-1 / +7 lines)
Lines 60-69 Link Here
60
Variable name completion try to keep typed characters even if they don't match to a part of the type name.<br>
60
Variable name completion try to keep typed characters even if they don't match to a part of the type name.<br>
61
e.g: Element rootE| is completed to Element rootElement.
61
e.g: Element rootE| is completed to Element rootElement.
62
</li>
62
</li>
63
<li>Added API <code>org.eclipse.jdt.core.CorrectionEngine#getAllWarningTokens()</code> to 
64
    get all the valid warning tokens, which can be used into <code>@SuppressWarnings</code>
65
    annotations. See bug 
66
    <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=126326">126326</a> for details.</li>
63
</ul>
67
</ul>
64
68
65
<h3>Problem Reports Fixed</h3>
69
<h3>Problem Reports Fixed</h3>
66
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=120838">120838</a>
70
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=126326">126326</a>
71
[api] all supported SuppressWarning tokens
72
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=120838">120838</a>
67
typos in spec of ICodeAssist
73
typos in spec of ICodeAssist
68
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=126227">126227</a>
74
<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=126227">126227</a>
69
default constructor not resolving for method-level classes
75
default constructor not resolving for method-level classes
(-)model/org/eclipse/jdt/core/CorrectionEngine.java (+20 lines)
Lines 395-400 Link Here
395
			}
395
			}
396
		}
396
		}
397
	};
397
	};
398
399
	
400
	/**
401
	 * Return an array of strings which contains one entry per warning token
402
	 * accepted by the <code>@SuppressWarnings</code> annotation. This array is
403
	 * neither null nor empty, it contains at least the String <code>all</code>.
404
	 * It should not be modified by the caller (please take a copy if modifications
405
	 * are needed).<br>
406
	 * <b>Note:</b> The tokens returned are not necessarily standardized across Java 
407
	 * compilers. If you were to use one of these tokens in a <code>@SuppressWarnings</code> 
408
	 * annotation in the Java source code, the effects (if any) may vary from 
409
	 * compiler to compiler.
410
	 * 
411
	 * @return an array of strings which contains one entry per warning token
412
	 * 			accepted by the <code>@SuppressWarnings</code> annotation.
413
	 * @since 3.2
414
	 */
415
	public static String[] getAllWarningTokens() {
416
		return CompilerOptions.warningTokens;
417
	}
398
	
418
	
399
	/**
419
	/**
400
	 * Helper method for decoding problem marker attributes. Returns an array of String arguments
420
	 * Helper method for decoding problem marker attributes. Returns an array of String arguments
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (-1 / +24 lines)
Lines 910-915 Link Here
910
	}
910
	}
911
	
911
	
912
	public static String warningTokenFromIrritant(long irritant) {
912
	public static String warningTokenFromIrritant(long irritant) {
913
		// keep in sync with warningTokens and warningTokenToIrritant
913
		int irritantInt = (int) irritant;
914
		int irritantInt = (int) irritant;
914
		if (irritantInt == irritant) {
915
		if (irritantInt == irritant) {
915
			switch (irritantInt) {
916
			switch (irritantInt) {
Lines 954-969 Link Here
954
					return "dep-ann"; //$NON-NLS-1$
955
					return "dep-ann"; //$NON-NLS-1$
955
				case (int)(RawTypeReference >>> 32):
956
				case (int)(RawTypeReference >>> 32):
956
					return "unchecked"; //$NON-NLS-1$
957
					return "unchecked"; //$NON-NLS-1$
957
				case (int) UnusedLabel:
958
				case (int) (UnusedLabel >>> 32):
958
					return "unused"; //$NON-NLS-1$
959
					return "unused"; //$NON-NLS-1$
959
				case (int) (DiscouragedReference >>> 32) :
960
				case (int) (DiscouragedReference >>> 32) :
960
				case (int) (ForbiddenReference >>> 32) :
961
				case (int) (ForbiddenReference >>> 32) :
961
					return "restriction"; //$NON-NLS-1$
962
					return "restriction"; //$NON-NLS-1$
963
				case (int) (NullReference >>> 32) :
964
					return "null"; //$NON-NLS-1$
962
			}
965
			}
963
		}
966
		}
964
		return null;
967
		return null;
965
	}
968
	}
969
	// keep in sync with warningTokenToIrritant and warningTokenFromIrritant
970
	public final static String[] warningTokens = {
971
		"all", //$NON-NLS-1$
972
		"boxing", //$NON-NLS-1$
973
		"dep-ann", //$NON-NLS-1$
974
		"deprecation", //$NON-NLS-1$
975
		"finally", //$NON-NLS-1$
976
		"hiding", //$NON-NLS-1$
977
		"incomplete-switch", //$NON-NLS-1$
978
		"nls", //$NON-NLS-1$
979
		"null", //$NON-NLS-1$
980
		"restriction", //$NON-NLS-1$
981
		"serial", //$NON-NLS-1$
982
		"static-access", //$NON-NLS-1$
983
		"synthetic-access", //$NON-NLS-1$
984
		"unchecked", //$NON-NLS-1$
985
		"unqualified-field-access", //$NON-NLS-1$
986
		"unused", //$NON-NLS-1$
987
	};
966
	public static long warningTokenToIrritant(String warningToken) {
988
	public static long warningTokenToIrritant(String warningToken) {
989
		// keep in sync with warningTokens and warningTokenFromIrritant
967
		if (warningToken == null || warningToken.length() == 0) return 0;
990
		if (warningToken == null || warningToken.length() == 0) return 0;
968
		switch (warningToken.charAt(0)) {
991
		switch (warningToken.charAt(0)) {
969
			case 'a' :
992
			case 'a' :

Return to bug 126326