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 34331 Details for
Bug 126326
[api] all supported SuppressWarning tokens
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch plus test case
org.eclipse.jdt.core_02_wip.txt (text/plain), 8.68 KB, created by
Maxime Daniel
on 2006-02-08 05:11:25 EST
(
hide
)
Description:
Patch plus test case
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2006-02-08 05:11:25 EST
Size:
8.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java,v >retrieving revision 1.54 >diff -u -r1.54 TestAll.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java 24 Jan 2006 10:50:06 -0000 1.54 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java 8 Feb 2006 09:46:30 -0000 >@@ -55,6 +55,7 @@ > standardTests.add(RuntimeTests.class); > standardTests.add(DebugAttributeTest.class); > standardTests.add(NullReferenceTest.class); >+ standardTests.add(CompilerInvocationTests.class); > > // add all javadoc tests > for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) { >Index: src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >=================================================================== >RCS file: src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >diff -N src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,72 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.core.tests.compiler.regression; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; >+ >+import junit.framework.Test; >+ >+/** >+ * This class is meant to gather test cases related to the invocation of the >+ * compiler, be it at an API or non API level. >+ */ >+public class CompilerInvocationTests extends AbstractRegressionTest { >+ >+public CompilerInvocationTests(String name) { >+ super(name); >+} >+ >+ // Static initializer to specify tests subset using TESTS_* static variables >+ // All specified tests which does not belong to the class are skipped... >+ // Only the highest compliance level is run; add the VM argument >+ // -Dcompliance=1.4 (for example) to lower it if needed >+ static { >+// TESTS_NAMES = new String[] { "test001" }; >+// TESTS_NUMBERS = new int[] { 1 }; >+// TESTS_RANGE = new int[] { 1, -1 }; >+// TESTS_RANGE = new int[] { 1, 2049 }; >+// TESTS_RANGE = new int[] { 449, 451 }; >+// TESTS_RANGE = new int[] { 900, 999 }; >+ } >+ >+public static Test suite() { >+ return buildTestSuite(testClass()); >+} >+ >+public static Class testClass() { >+ return CompilerInvocationTests.class; >+} >+ >+// irritant vs warning token >+public void test001_irritant_warning_token() { >+ String [] tokens = new String[64]; >+ Map matcher = new HashMap(); >+ long irritant; >+ String token; >+ for (int i = 0; i < 64; i++) { >+ if ((token = tokens[i] = CompilerOptions.warningTokenFromIrritant(irritant = 1L << i)) != null) { >+ matcher.put(token, token); >+ assertTrue((irritant & CompilerOptions.warningTokenToIrritant(token)) != 0); >+ } >+ } >+ String [] allTokens = CompilerOptions.warningTokens; >+ int length = allTokens.length; >+ matcher.put("all", "all"); // all gets undetected in the From/To loop >+ assertEquals(allTokens.length, matcher.size()); >+ for (int i = 0; i < length; i++) { >+ assertNotNull(matcher.get(allTokens[i])); >+ } >+} >+ >+} >#P org.eclipse.jdt.core >Index: buildnotes_jdt-core.html >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v >retrieving revision 1.4950 >diff -u -r1.4950 buildnotes_jdt-core.html >--- buildnotes_jdt-core.html 8 Feb 2006 09:20:25 -0000 1.4950 >+++ buildnotes_jdt-core.html 8 Feb 2006 09:46:33 -0000 >@@ -60,10 +60,16 @@ > Variable name completion try to keep typed characters even if they don't match to a part of the type name.<br> > e.g: Element rootE| is completed to Element rootElement. > </li> >+<li>Added API <code>org.eclipse.jdt.core.CorrectionEngine#getAllWarningTokens()</code> to >+ get all the valid warning tokens, which can be used into <code>@SuppressWarnings</code> >+ annotations. See bug >+ <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=126326">126326</a> for details.</li> > </ul> > > <h3>Problem Reports Fixed</h3> >-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=120838">120838</a> >+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=126326">126326</a> >+[api] all supported SuppressWarning tokens >+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=120838">120838</a> > typos in spec of ICodeAssist > <br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=126227">126227</a> > default constructor not resolving for method-level classes >Index: model/org/eclipse/jdt/core/CorrectionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CorrectionEngine.java,v >retrieving revision 1.49 >diff -u -r1.49 CorrectionEngine.java >--- model/org/eclipse/jdt/core/CorrectionEngine.java 28 Oct 2005 11:52:04 -0000 1.49 >+++ model/org/eclipse/jdt/core/CorrectionEngine.java 8 Feb 2006 09:46:34 -0000 >@@ -395,6 +395,26 @@ > } > } > }; >+ >+ >+ /** >+ * Return an array of strings which contains one entry per warning token >+ * accepted by the <code>@SuppressWarnings</code> annotation. This array is >+ * neither null nor empty, it contains at least the String <code>all</code>. >+ * It should not be modified by the caller (please take a copy if modifications >+ * are needed).<br> >+ * <b>Note:</b> The tokens returned are not necessarily standardized across Java >+ * compilers. If you were to use one of these tokens in a <code>@SuppressWarnings</code> >+ * annotation in the Java source code, the effects (if any) may vary from >+ * compiler to compiler. >+ * >+ * @return an array of strings which contains one entry per warning token >+ * accepted by the <code>@SuppressWarnings</code> annotation. >+ * @since 3.2 >+ */ >+ public static String[] getAllWarningTokens() { >+ return CompilerOptions.warningTokens; >+ } > > /** > * Helper method for decoding problem marker attributes. Returns an array of String arguments >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.159 >diff -u -r1.159 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 6 Feb 2006 10:32:05 -0000 1.159 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 8 Feb 2006 09:46:34 -0000 >@@ -910,6 +910,7 @@ > } > > public static String warningTokenFromIrritant(long irritant) { >+ // keep in sync with warningTokens and warningTokenToIrritant > int irritantInt = (int) irritant; > if (irritantInt == irritant) { > switch (irritantInt) { >@@ -954,16 +955,38 @@ > return "dep-ann"; //$NON-NLS-1$ > case (int)(RawTypeReference >>> 32): > return "unchecked"; //$NON-NLS-1$ >- case (int) UnusedLabel: >+ case (int) (UnusedLabel >>> 32): > return "unused"; //$NON-NLS-1$ > case (int) (DiscouragedReference >>> 32) : > case (int) (ForbiddenReference >>> 32) : > return "restriction"; //$NON-NLS-1$ >+ case (int) (NullReference >>> 32) : >+ return "null"; //$NON-NLS-1$ > } > } > return null; > } >+ // keep in sync with warningTokenToIrritant and warningTokenFromIrritant >+ public final static String[] warningTokens = { >+ "all", //$NON-NLS-1$ >+ "boxing", //$NON-NLS-1$ >+ "dep-ann", //$NON-NLS-1$ >+ "deprecation", //$NON-NLS-1$ >+ "finally", //$NON-NLS-1$ >+ "hiding", //$NON-NLS-1$ >+ "incomplete-switch", //$NON-NLS-1$ >+ "nls", //$NON-NLS-1$ >+ "null", //$NON-NLS-1$ >+ "restriction", //$NON-NLS-1$ >+ "serial", //$NON-NLS-1$ >+ "static-access", //$NON-NLS-1$ >+ "synthetic-access", //$NON-NLS-1$ >+ "unchecked", //$NON-NLS-1$ >+ "unqualified-field-access", //$NON-NLS-1$ >+ "unused", //$NON-NLS-1$ >+ }; > public static long warningTokenToIrritant(String warningToken) { >+ // keep in sync with warningTokens and warningTokenFromIrritant > if (warningToken == null || warningToken.length() == 0) return 0; > switch (warningToken.charAt(0)) { > case 'a' :
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 126326
: 34331