diff options
301 files changed, 8750 insertions, 8933 deletions
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters deleted file mode 100644 index fc466c937..000000000 --- a/org.eclipse.jdt.core/.settings/.api_filters +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<component id="org.eclipse.jdt.core" version="2"> - <resource path="dom/org/eclipse/jdt/core/dom/ASTParser.java" type="org.eclipse.jdt.core.dom.ASTParser"> - <filter id="1142947843"> - <message_arguments> - <message_argument value="3.5.2"/> - <message_argument value="setIgnoreMethodBodies(boolean)"/> - </message_arguments> - </filter> - </resource> - <resource path="model/org/eclipse/jdt/core/ICompilationUnit.java" type="org.eclipse.jdt.core.ICompilationUnit"> - <filter id="1210056707"> - <message_arguments> - <message_argument value="3.5.2"/> - <message_argument value="IGNORE_METHOD_BODIES"/> - </message_arguments> - </filter> - </resource> - <resource path="search/org/eclipse/jdt/core/search/TypeNameMatch.java" type="org.eclipse.jdt.core.search.TypeNameMatch"> - <filter id="336744520"> - <message_arguments> - <message_argument value="org.eclipse.jdt.core.search.TypeNameMatch"/> - </message_arguments> - </filter> - </resource> -</component> diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/core/compiler/batch/BatchCompiler.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/core/compiler/batch/BatchCompiler.java index 1a51c4995..09d02cb56 100644 --- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/core/compiler/batch/BatchCompiler.java +++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/core/compiler/batch/BatchCompiler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2010 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 @@ -49,7 +49,7 @@ public final class BatchCompiler { * @return whether the compilation completed successfully */ public static boolean compile(String commandLine, PrintWriter outWriter, PrintWriter errWriter, CompilationProgress progress) { - return Main.compile(Main.tokenize(commandLine), outWriter, errWriter, progress); + return compile(Main.tokenize(commandLine), outWriter, errWriter, progress); } /** diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java index a5929944b..e6d32fd1f 100644 --- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java +++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java @@ -136,6 +136,13 @@ public NameEnvironmentAnswer findClass(char[] typeName, String qualifiedPackageN if (binaryExists) { try { ClassFileReader reader = ClassFileReader.read(this.path + qualifiedBinaryFileName); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115, package names are to be treated case sensitive. + String typeSearched = qualifiedPackageName.length() > 0 ? + qualifiedPackageName.replace(File.separatorChar, '/') + "/" + fileName //$NON-NLS-1$ + : fileName; + if (!CharOperation.equals(reader.getName(), typeSearched.toCharArray())) { + reader = null; + } if (reader != null) return new NameEnvironmentAnswer( reader, diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties index 11c4004e5..6ad427b8b 100644 --- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties +++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties @@ -1,7 +1,7 @@ #Format: compiler.name = word1 word2 word3 compiler.name = Eclipse Compiler for Java(TM) #Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)] -compiler.version = 0.A58, 3.6.0 +compiler.version = 0.B14a, 3.7.0 M3 compiler.copyright = Copyright IBM Corp 2000, 2010. All rights reserved. ###{ObjectTeams: diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html index bfa4eff2d..7137c5e40 100644 --- a/org.eclipse.jdt.core/buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html @@ -3,14 +3,14 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="IBM"> - <title>JDT/Core Release Notes 3.6</title> + <title>JDT/Core Release Notes 3.7</title> <link rel="stylesheet" href="jdt_core_style.css" charset="iso-8859-1" type="text/css"> </head> <body text="#000000" bgcolor="#FFFFFF"> <table border=0 cellspacing=5 cellpadding=2 width="100%" > <tr> <td align="left" width="72%" class="title1"> - <font size="+3"><b>jdt core - build notes 3.6 stream</b></font> + <font size="+3"><b>jdt core - build notes 3.7 stream</b></font> </td> </tr> <tr><td align="left" width="72%" class="title2"><font size="-2">Java development tools core</font></td></tr> @@ -21,8 +21,8 @@ Here are the build notes for the Eclipse JDT/Core plug-in project <a href="http://www.eclipse.org/jdt/core/index.php"><b>org.eclipse.jdt.core</b></a>, describing <a href="https://bugs.eclipse.org/bugs" target=new>bug</a> resolution and substantial changes in the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core"><b>HEAD</b></a> branch. - For more information on 3.6 planning, please refer to <a href="http://www.eclipse.org/jdt/core/r3.6/index.php#release-plan">JDT/Core release plan</a>, - the next <a href="http://www.eclipse.org/jdt/core/r3.6/index.php#milestone-plan">milestone plan</a>, + For more information on 3.7 planning, please refer to <a href="http://www.eclipse.org/jdt/core/r3.7/index.php#release-plan">JDT/Core release plan</a>, + the next <a href="http://www.eclipse.org/jdt/core/r3.7/index.php#milestone-plan">milestone plan</a>, the overall <a href="http://www.eclipse.org/eclipse/development/eclipse_project_plan_3_6.html">official plan</a>, or the <a href="http://www.eclipse.org/eclipse/platform-releng/buildSchedule.html">build schedule</a>. This present document covers all changes since Release 3.5 (also see a summary of <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/API_changes.html">API changes</a>). @@ -40,2238 +40,547 @@ </td> </tr> </table> -<a name="v_A58"></a> +<a name="v_B14a"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6 - June 3, 2010 - 3.6.0 -<br>Project org.eclipse.jdt.core v_A58 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A58">cvs</a>). +Eclipse SDK 3.7M3 - September 21, 2010 - 3.7.0 M3 +<br>Project org.eclipse.jdt.core v_B14a +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B14a">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=315568">315568</a> -improve Javadoc of SearchPattern#createPattern(String, int, int, int) +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325567">325567</a> +A blocking "java.lang.IllegalArgumentException: info cannot be null" exception -<a name="v_A57"></a> +<a name="v_B13a"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6RC4 - June 3, 2010 - 3.6.0 RC4 -<br>Project org.eclipse.jdt.core v_A57 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A57">cvs</a>). +Eclipse SDK 3.7M2 - September 21, 2010 - 3.7.0 M2 +<br>Project org.eclipse.jdt.core v_B13a +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B13a">cvs</a>). <h2>What's new in this drop</h2> -<ul> -<li>Use default disabling/enabling tags in the samples of the Javadoc comments -of the formatter constants <code>FORMATTER_DISABLING_TAG</code> and -<code>FORMATTER_ENABLING_TAG</code>.</li> -<li>Fixed minor javadoc issues of <code>createStrictHierarchyScope()</code>.</li> -</ul> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=314709">314709</a> -Clarify -encoding <encoding name> in jdt_api_compile.htm +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325755">325755</a> +[compiler] wrong initialization state after conditional expression -<a name="v_A56"></a> +<a name="v_B13"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6RC3 - May 27, 2010 - 3.6.0 RC3 -<br>Project org.eclipse.jdt.core v_A56 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A56">cvs</a>). +Eclipse SDK 3.7M2 - September 15, 2010 +<br>Project org.eclipse.jdt.core v_B13 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B13">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313890">313890</a> -Migration guide to 3.6 for containers with MANIFEST-referred entries -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965">313965</a> -Breaking change in classpath container API +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325229">325229</a> +[compiler] eclipse compiler differs from javac when assert is present (FUP of bug 319510) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325270">325270</a> +[content assist] Parameter names are not displayed for static inner class of an external jar +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=325321">325321</a> +[compiler] Synthetic constructors for non-static inner classes can exceed 255 parameters -> ClassFormatError -<a name="v_A55"></a> +<a name="v_B12a"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6RC3 - May 25, 2010 -<br>Project org.eclipse.jdt.core v_A55 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A55">cvs</a>). +Eclipse SDK 3.7M2 - September 13, 2010 +<br>Project org.eclipse.jdt.core v_B12a +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B12a">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313706">313706</a> -Replace ie. with i.e. in jdt.core documentation +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=324840">324840</a> +[compiler] Improving debug strings for Break statement, IntLiteral and CaseStatement +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=324848">324848</a> +[1.6][compiler] NullPointerException when trying to synchronize on non-existing outer class instance -<a name="v_A54"></a> +<a name="v_B11"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6RC2 - May 20, 2010 - 3.6.0 RC2 -<br>Project org.eclipse.jdt.core v_A54 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A54">cvs</a>). +Eclipse SDK 3.7M2 - September 9, 2010 - 3.7.0 M2 +<br>Project org.eclipse.jdt.core v_B11 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B11">cvs</a>). <h2>What's new in this drop</h2> <ul> -<li> -Added a new preference to force the formatter to try to keep nested expressions on one line. -<p> -This new preference is controlled with the option:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_WRAP_OUTER_EXPRESSIONS_WHEN_NESTED</code> +<li>Adding missing API methods on org.eclipse.jdt.core.ILocalVariable (see details in <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48420">bug 48420</a>): <pre> -/** - * FORMATTER / Option to wrap outer expressions in nested expressions - * - option id: "org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" - * - possible values: { TRUE, FALSE } - * - default: TRUE - * - * This option changes the formatter behavior when nested method calls are encountered. - * Since 3.6, the formatter tries to wrap outermost method calls first to have a better output. - * For example, let's say we are using the Eclipse built-in profile with a max line width=40+space for tab policy. - * Then consider the following snippet: - * - * public class X01 { - * void test() { - * foo(bar(1, 2, 3, 4), bar(5, 6, 7, 8)); - * } - * } - * - * With this new strategy, the formatter will wrap the line earlier, between the arguments of the message call - * for this example, and then it will allow to keep each nested call on a single line. - * Hence, the output will be: - * - * public class X01 { - * void test() { - * foo(bar(1, 2, 3, 4), - * bar(5, 6, 7, 8)); - * } - * } - * - * Important notes: - * 1. This new behavior is automatically activated (i.e. the default value for this preference is {@link #TRUE}). - * If the backward compatibility regarding previous versions' formatter behavior (i.e. before 3.6 version) is necessary, - * then the preference needs to be set to {@link #FALSE} to retrieve the previous formatter behavior. - * 2. The new strategy currently only applies to nested method calls, but might be extended to other nested expressions in future versions - * - * @see #TRUE - * @see #FALSE - * @since 3.6 - */ + /** + * Returns true if this local variable is a method parameter, false otherwise. + * + * @return true if this local variable is a method parameter, false otherwise + * @since 3.7 + */ + boolean isParameter(); + + /** + * Returns the modifier flags for this local variable. The flags can be examined using class. + * + * Note that only flags as indicated in the source are returned. + * + * @return the modifier flags for this local variable + * @see Flags + * @since 3.7 + */ + int getFlags(); + + /** + * Returns the declaring member of this local variable. + * + * This is a handle-only method. + * + * @return the declaring member of this local variable + * @since 3.7 + */ + IMember getDeclaringMember(); + + /** + * Returns the Java type root in which this local variable is declared. + * + * This is a handle-only method. + * + * @return the Java type root in which this local variable is declared + * @since 3.7 + */ + ITypeRoot getTypeRoot(); </pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313524">313524</a> for more details. </li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313524">313524</a> -[formatter] Add preference for improved lines wrapping in nested method calls -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313109">313109</a> -@SuppressWarnings on multiple locals is marked unnecessary if any local is never used - -<a name="v_A53"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6RC1 - May 12, 2010 - 3.6.0 RC1 -<br>Project org.eclipse.jdt.core v_A53 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A53">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=312326">312326</a> -IllegalArgumentException using open type dialog -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310159">310159</a> -Hang in JavaModel.getExternalTarget(JavaModel.java:333) - -<a name="v_A52"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6RC1 - May 11, 2010 -<br>Project org.eclipse.jdt.core v_A52 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A52">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847">157847</a> -NPE in WildcardBinding.computeUniqueKey during code assist -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311849">311849</a> -[quick fix] @SuppressWarnings does not work as expected inside a for loop - -<a name="v_A51"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6RC1 - May 8, 2010 -<br>Project org.eclipse.jdt.core v_A51 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A51">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306170">306170</a> -[perfs] Regression for FullSourceWorkspaceTypeHierarchyTests#testPerfAllTypes() -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298844">298844</a> -[formatter] New lines in empty method body wrong behavior -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311864">311864</a> -[formatter] NPE with empty {@code } - -<a name="v_A50"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6RC1 - May 6, 2010 -<br>Project org.eclipse.jdt.core v_A50 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A50">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li> -Added a new preference to switch on/off the usage of the disabling/enabling tags of the formatter. -<p> -This new preference is controlled with the option:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS</code> +<li>Adding missing API method on org.eclipse.jdt.core.ITypeParameter (see details in <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=48420">bug 48420</a>): <pre> -/** - * FORMATTER / Option to use the disabling and enabling tags defined respectively by the {@link #FORMATTER_DISABLING_TAG} and the {@link #FORMATTER_ENABLING_TAG} options. - * - option id: "org.eclipse.jdt.core.formatter.use_on_off_tags" - * - possible values: TRUE / FALSE - * - default: FALSE - * - * @since 3.6 - */ + /** + * Returns the Java type root in which this type parameter is declared. + * + * This is a handle-only method. + * + * @return the Java type root in which this type parameter is declared + * @since 3.7 + */ + ITypeRoot getTypeRoot(); </pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582">311582</a> for more details. </li> </ul> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311617">311617</a> -[formatter] provide default tags to enable/disable formatter -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582">311582</a> -[formatter] Master switch to enable/disable on/off tags -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307040">307040</a> -Search Job with HierarchyScope on Object does not cancel -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302295">302295</a> -After associating source folder with rt.jar project refresh takes exceedingly long time. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311048">311048</a> -AbortCompilation propagated from CompilationUnitProblemFinder.process() - -<a name="v_A49"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6RC1 - May 4, 2010 -<br>Project org.eclipse.jdt.core v_A49 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A49">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310811">310811</a> -[perfs] Big regression on FullSourceWorkspaceFormatterTests#testFormatDefaultBigFile() - -<a name="v_A48"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - April 25, 2010 - 3.6.0 M7 -<br>Project org.eclipse.jdt.core v_A48 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A48">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310330">310330</a> -Add multiple encoding support for the batch compiler - -<a name="v_A47"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - April 25, 2010 -<br>Project org.eclipse.jdt.core v_A47 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A47">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309835">309835</a> -[formatter] adds blank lines on each run -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310213">310213</a> -AIOOBE in IndexSelector.initializeIndexLocations() -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309966">309966</a> -IType#getKey() does not work for unresolved local ITypes - -<a name="v_A46"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - April 23, 2010 -<br>Project org.eclipse.jdt.core v_A46 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A46">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=59891">59891</a> -[formatter] improve lines wrapping in nested method calls -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306172">306172</a> -[perfs] Invalid test duration for FullSourceWorkspaceTypeHierarchyTests#testPerSuperTypes() -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267091">267091</a> -[content assist] After 'implements' interface members are not proposed -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534">261534</a> -content assist after instanceof should also work after && -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980">308980</a> -[content assist]An initializer inside a non-array field declaration confuses content assist -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310002">310002</a> -ToolFactory.createScanner(..) should use workspace compliance -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291528">291528</a> -Synchronize project warning/error settings to build.properties -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309787">309787</a> -Extension point "org.eclipse.jdt.core.codeFormatter" is ignored -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=244820">244820</a> -Content assist after 'instanceof' should also work in assignment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309706">309706</a> -[formatter] doesn't work when code has three semicolons side by side - -<a name="v_A45"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - April 20, 2010 -<br>Project org.eclipse.jdt.core v_A45 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A45">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305037">305037</a> -missing story for attributes of referenced JARs in classpath containers -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305116">305116</a> -[index] Improve performance of indexes results tables -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236306">236306</a> -[content assist] for method invocation in variable initializer should not guess variable -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865">302865</a> -Issue with "import" a class and "import static" a method with the same name -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309022">309022</a> -[ImportRewrite] Add Import wrongly removes import for nested type - -<a name="v_A44"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - April 13, 2010 -<br>Project org.eclipse.jdt.core v_A44 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A44">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308754">308754</a> -CompilationUnit.rewrite messes up .class-literal in annotation instead of changing class to interface -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306519">306519</a> -JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject) should allow null project -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308428">308428</a> -Possible problem to get corrections with surrogate characters -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307295">307295</a> -Task tags and task priorities -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308476">308476</a> -Test ClasspathTests#testBug308150 fails on all platforms -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305043">305043</a> -Internal error during classpath init -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307486">307486</a> -DBCS3.6: Fail to propose Ext-B labels with content assist in Java Editor -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308256">308256</a> -DiagnosticListener always supplies Diagnostic.getSource()==null -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308356">308356</a> -codeSelect(..) doesn't work for local variable with surrogate in name -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308245">308245</a> -Valid code fails to compile in 3.6 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307885">307885</a> -Error message for instanceof <parameterized type> wrong arguments -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704">249704</a> -[code assist] autocomplete with anonymous classes does stop working -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308150">308150</a> -JAR with invalid Class-Path entry in MANIFEST.MF crashes the project - -<a name="v_A43"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - April 6, 2010 -<br>Project org.eclipse.jdt.core v_A43 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A43">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306223">306223</a> -[search] Searching for annotation references report all type references -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292087">292087</a> -anonymous class in array member initializer confuses content assist -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307337">307337</a> -[content assist] Default constructor should not be proposed for anonymous types -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306568">306568</a> -[ImportRewrite] Add Import does not work for nested type when package is on-demand imported - -<a name="v_A42"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - March 30, 2010 -<br>Project org.eclipse.jdt.core v_A42 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A42">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=202634">202634</a> -[codeassist] missing super proposal in specific source -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304394">304394</a> -IJavaElement#getAttachedJavadoc(IProgressMonitor) should support referenced entries -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305122">305122</a> -FUP of 302949 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306917">306917</a> -Exception occurred during compilation unit conversion: -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306196">306196</a> -[search] NPE while searching for annotation references in rt.jar of JRE 6.0 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288658">288658</a> -[compiler][1.5] Annotations visibility issues - -<a name="v_A41"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - March 23, 2010 -<br>Project org.eclipse.jdt.core v_A41 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A41">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305518">305518</a> -[formatter] Line inside <pre> tag is wrongly indented by one space when starting just after the star -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295825">295825</a> -[formatter] Commentaries are running away after formatting are used -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306477">306477</a> -Indexer(?) fails to recognise enum as a type -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305830">305830</a> -[formatter] block comment should not be formatted when a non-nls tag is on the same line -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300031">300031</a> -The deprecation warning for a type should not include the package name -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306078">306078</a> -Navigate to Inaccessible Field -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=209479">209479</a> -infinite loop in BindingKey when signatures are invalid -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293558">293558</a> -[quick assist] "Invert if statement" fails when comment follows -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=182459">182459</a> -[compiler] Inconsistent error range for unresolved field -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=192233">192233</a> -[AST] CompilationUnit.rewrite() removes whitespace between return type and method name -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306073">306073</a> -ASTRewrite Javadoc wrongly talks about getTargetSourceRangeComputer -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305001">305001</a> -Exception occurred in listener of Java element change notification -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305590">305590</a> -Redundant null check false-positive -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305755">305755</a> -Remove deprecated API that has been added for 3.6 - -<a name="v_A40"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M7 - March 16, 2010 -<br>Project org.eclipse.jdt.core v_A40 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A40">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305371">305371</a> -[formatter] Unexpected indentation of line comment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305281">305281</a> -[formatter] Turning off formatting changes comment's formatting - -<a name="v_A39"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M6 - March 9, 2010 - 3.6.0 M6 -<br>Project org.eclipse.jdt.core v_A39 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A39">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289057">289057</a> -Java Content Assist taking too long -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303830">303830</a> -"X cannot be resolved or is not a field" erroneously reported -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235658">235658</a> -Valid identifier unrecognized. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304841">304841</a> -[search] NPE in IndexSelector.initializeIndexLocations -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295866">295866</a> -FormalParameter in JDT DOM/AST documentation -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304817">304817</a> -Review documentation of ASTParser class +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=324762">324762</a> +Compiler thinks there is deadcode and removes it! +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292478">292478</a> +Report potentially null across variable assignment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=324748">324748</a> +JDT core tests have restrictive range on com.ibm.icu +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633">323633</a> +[1.5][compiler] Reconciler issues mixing 1.4 projects with & 1.5 project with generics. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=317046">317046</a> +Exception during debugging when hover mouse over a field +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=48420">48420</a> +[API] ILocalVariable and ITypeParameter should provide more methods +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321414">321414</a> +Synthetic constructors can exceed 255 parameters -> ClassFormatError -<a name="v_A38"></a> +<a name="v_B10"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M6 - March 5, 2010 -<br>Project org.eclipse.jdt.core v_A38 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A38">cvs</a>). +Eclipse SDK 3.7M2 - September 7, 2010 +<br>Project org.eclipse.jdt.core v_B10 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B10">cvs</a>). <h2>What's new in this drop</h2> <ul> -<li> -Added two new preferences to allow to disable the formatter in a section of the code. -These two preference define respectively the tag which disables the formatting -and the tag which re-enable it. -<p> -These new preferences are controlled with the options:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG</code> -<code>DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG</code> +<li>Code formatter: 4 new options were added to better handle the addition of +new lines after annotations. <pre> -/** - * FORMATTER / Option to define the tag to put in a comment to disable the formatting. - * See the {@link #FORMATTER_ENABLING_TAG} option to re-enable it. - * - option id: "org.eclipse.jdt.core.formatter.disabling_tag" - * - possible values: String, with constraints mentioned below - * - default: "" - * - * Note that: + * FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD + * FORMATTER / Option to insert a new line after an annotation on a field declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT * - * 1. The tag name will be trimmed. Hence if it does contain white spaces - * at the beginning or at the end, they will not be taken into account while - * searching for the tag in the comments - * 2. If a tag is starting with a letter or digit, then it cannot be leaded by - * another letter or digit to be recognized - * (<b><i>"ToDisableFormatter"</i></b> will not be recognized as a disabling tag - * <b><i>"DisableFormatter"</i></b>, but <b><i>"Re:DisableFormatter"</i></b> - * will be detected for either tag <b><i>"DisableFormatter"</i></b> or - * <b><i>":DisableFormatter"</i></b>). - * Respectively, a tag ending with a letter or digit cannot be followed by a letter - * or digit to be recognized (<b><i>"DisableFormatter1"</i></b> will not be - * recognized as a disabling tag <b><i>"DisableFormatter"</i></b>, but - * <b><i>"DisableFormatter:1"</i></b> will be detected either for tag - * <b><i>"DisableFormatter"</i></b> or <b><i>"DisableFormatter:"</i></b>) - * 3. As soon as the formatter encounters the defined disabling tag, it stops to - * format the code from the beginning of the comment including this tag. If it - * was already disabled, the tag has no special effect. - * For example, the second defined enabling tag "<b>disable-formatter</b>" - * in the following snippet is not necessary as the formatter was already disabled - * since the first one: - * class X { - * // disable-formatter - * void foo1() {} - * // disable-formatter - * void foo2() {} - * void bar1() {} - * void bar2() {} - * } + * FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD + * FORMATTER / Option to insert a new line after an annotation on a method declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT * - * 4. If no enabling tag is found by the formatter after the disabling tag, then - * the end of the snippet won't be formatted. - * For example, when a disabling tag is put at the beginning of the code, then - * the entire content of a compilation unit is not formatted: - * // disable-formatter - * class X { - * void foo1() {} - * void foo2() {} - * void bar1() {} - * void bar2() {} - * } - * - * 5. If a mix of disabling and enabling tags is done in the same comment, then - * the formatter will only take into account the last encountered tag in the - * comment. - * For example, in the following snippet, the formatter will be disabled after - * the comment: - * class X { - * /* - * * This is a comment with a mix of disabling and enabling tags: - * * - <b>disable-formatter</b> - * * - <b>enable-formatter</b> - * * - <b>disable-formatter</b> - * * The formatter will stop to format from the beginning of this comment... - * */ - * void foo() {} - * void bar() {} - * } - * - * 6. The tag cannot include newline character (i.e. '\n') but it can have white spaces. - * E.g. "<b>format: off</b>" is a valid disabling tag - * In the future, newlines may be used to support multiple disabling tags. - * - * @since 3.6 - */ - -/** - * FORMATTER / Option to define the tag to put in a comment to re-enable the - * formatting after it has been disabled (see {@link #FORMATTER_DISABLING_TAG}) - * - option id: "org.eclipse.jdt.core.formatter.enabling_tag" - * - possible values: String, with constraints mentioned below - * - default: "" - * - * Note that: - * - * 1. The tag name will be trimmed. Hence if it does contain white spaces - * at the beginning or at the end, they will not be taken into account while - * searching for the tag in the comments - * 2. If a tag is starting with a letter or digit, then it cannot be leaded by - * another letter or digit to be recognized - * (<b>"ReEnableFormatter"</b> will not be recognized as an enabling tag - * <b><i>"EnableFormatter"</i></b>, but <b><i>"Re:EnableFormatter"</i></b> - * will be detected for either tag <b><i>"EnableFormatter"</i></b> or - * <b><i>":EnableFormatter"</i></b>). - * Respectively, a tag ending with a letter or digit cannot be followed by a letter - * or digit to be recognized (<b><i>"EnableFormatter1"</i></b> will not be - * recognized as an enabling tag <b><i>"EnableFormatter"</i></b>, but - * <b><i>"EnableFormatter:1"</i></b> will be detected either for tag - * <b><i>"EnableFormatter"</i></b> or <b><i>"EnableFormatter:"</i></b>) - * 3. As soon as the formatter encounters the defined enabling tag, it re-starts - * to format the code just after the comment including this tag. If it was already - * active, i.e. already re-enabled or never disabled, the tag has no special effect. - * For example, the defined enabling tag "<b>enable-formatter</b>" - * in the following snippet is not necessary as the formatter has never been - * disabled: - * class X { - * void foo1() {} - * void foo2() {} - * // enable-formatter - * void bar1() {} - * void bar2() {} - * } - * - * Or, in the following other snippet, the second enabling tag is not necessary as - * the formatting will have been re-enabled by the first one: - * class X { - * // disable-formatter - * void foo1() {} - * void foo2() {} - * // enable-formatter - * void bar1() {} - * // enable-formatter - * void bar2() {} - * } - * - * 4. If a mix of disabling and enabling tags is done in the same comment, then - * the formatter will only take into account the last encountered tag in the - * comment. - * For example, in the following snippet, the formatter will be re-enabled after - * the comment: - * // disable-formatter - * class X { - * /* - * * This is a comment with a mix of disabling and enabling tags: - * * - <b>enable-formatter</b> - * * - <b>disable-formatter</b> - * * - <b>enable-formatter</b> - * * The formatter will restart to format after this comment... - * */ - * void foo() {} - * void bar() {} - * } - * - * 5. The tag cannot include newline character (i.e. '\n') but it can have white spaces. - * E.g. "<b>format: on</b>" is a valid enabling tag - * In the future, newlines may be used to support multiple enabling tags. - * - * @since 3.6 - */ -</pre> -<p>For example, the following snippet:</p> -<pre> -public class Test { -/* disable-formatter */ -void foo( ) { - // unformatted area -} -/* enable-formatter */ -void bar( ) { - // formatted area -} -} -</pre> -formatted with disabling tags = "disable-formatter" and enabling tags -= "enable-formatter" produces the following output: -<pre> -public class Test { - -/* disable-formatter * -void foo( ) { - // unformatted area -} -/* enable-formatter * - void bar() { - // formatted area - } -} -</pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=27079">27079</a> for more details. -</li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=129804">129804</a> -[dom] Local variable bindings from ASTParser#createASTs(.., String[], .., ..) have no declaring method -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304705">304705</a> -[formatter] Unexpected indentation of wrapped line comments when 'Never indent line comment on first column' preference is checked -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304656">304656</a> -StringIndexOutOfBoundsException when using JDT dom methods to process sourcefile -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304506">304506</a> -Task descriptions always have a space after the tag -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304081">304081</a> -IJavaProject#isOnClasspath(IJavaElement) returns false for type from referenced JAR -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304122">304122</a> -TypeBindings.getAnnotations() breaks interface -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304416">304416</a> -VerifyError after compiling without preserve all locals -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304529">304529</a> -[formatter] NPE when either the disabling or the enabling tag is not defined -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=27079">27079</a> -Tags for disabling/enabling code formatter (feature) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304316">304316</a> -NPE when javadoc URL is invalid - -<a name="v_A37"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M6 - March 2, 2010 -<br>Project org.eclipse.jdt.core v_A37 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A37">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>Added new configurable option to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551">295551</a>:<br> -<pre> -/** - * Compiler option ID: Further Determining the Effect of @SuppressWarnings if also - * COMPILER_PB_SUPPRESS_WARNINGS is enabled. - * When enabled, the @SuppressWarnings annotation can additionally be used to suppress - * optional compiler diagnostics that have been configured as ERROR. - * When disabled, all @SuppressWarnings annotations only affects warnings. + * FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE + * FORMATTER / Option to insert a new line after an annotation on a package declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT * - * Option id: "org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors" - * Possible values: { "enabled", "disabled" } - * Default: "disabled" - * - * @since 3.6 - * @category CompilerOptionID - */ -public static final String COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS = PLUGIN_ID + ".compiler.problem.suppressOptionalErrors"; -</pre> -</li> -<li> -Added a new formatter preferences to align method declaration. -<p> -This new preference is controlled with the option:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_METHOD_DECLARATION</code> -<pre> -/** - * FORMATTER / Option for alignment of method declaration - * - option id: "org.eclipse.jdt.core.formatter.alignment_for_method_declaration" - * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call - * - default: createAlignmentValue(false, WRAP_NO_SPLIT, INDENT_DEFAULT) - * - * @see #createAlignmentValue(boolean, int, int) - * @since 3.6 - */ -</pre> -<p>For example, the following snippet:</p> -<pre> -public class Test { -public final synchronized java.lang.String a_method_which_has_a_very_long_name() { -return null; -} -} -</pre> -formatted with this preference activated as 'Wrap only when necessary', will -produce the following output: -<pre> -public class Test { - public final synchronized java.lang.String - a_method_which_has_a_very_long_name() { - return null; - } -} -</pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284789">284789</a> for more details. -</li> -<li>New API to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=246594">246594</a>. See the bug for details. -<pre> -org.eclipse.jdt.core.ITypeParameter - /** - * Returns the signatures for this type parameter's bounds. The type parameter may have - * been declared as part of a type or a method. The signatures represent only the individual - * bounds and do not include the type variable name or the <code>extends</code> keyword. - * The signatures may be either unresolved (for source types) or resolved (for binary types). - * See {@link Signature} for details. - * - * @return the signatures for the bounds of this formal type parameter - * @throws JavaModelException - * if this element does not exist or if an exception occurs while accessing its corresponding resource. - * @see Signature - * @since 3.6 - */ - String[] getBoundsSignatures() throws JavaModelException; + * FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE + * FORMATTER / Option to insert a new line after an annotation on a type declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT </pre> +The addition of new lines after annotations has been discussed in <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=308000">bug 308000</a><br> +Also note that previously available code formatter constant FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER has been deprecated.<br> +All new options must be enabled to activate old strategy. </li> <li> -Added a new formatter preference to enable or disable the formatting of line -comments that start on the first column.<br> -Note that the indentation of line comments will also be disabled when activating -this option, as otherwise the formatter could not produce stable outputs... -<p> -The default is to format these comments to have a backward compatible behavior. -</p><p> -This new preferences is controlled with the options:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN</code> +The previously added new APIs: +<blockquote> +<code>org.eclipse.jdt.core.IImportDeclaration#getNameRange()</code>,<br> +<code>org.eclipse.jdt.core.IPackageDeclaration#getNameRange()</code> +</blockquote> +have been moved to the org.eclipse.jdt.core.ISourceReference interface. See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321764">321764</a> for details: <pre> /** - * FORMATTER / Option to format line comments that start on the first column - * - option id: "org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" - * - possible values: { TRUE, FALSE } - * - default: TRUE + * Returns the name range associated with this element. * - * Note that this option is ignored if either the - * {@link #FORMATTER_COMMENT_FORMAT_LINE_COMMENT} option has been set to - * {@link #FALSE} or the formatter is created with the mode - * {@link ToolFactory#M_FORMAT_NEW}. + * If the element is an IMember, it returns + * the source range of this member's simple name, + * or null if this member does not have a name + * (for example, an initializer), or if this member does not have + * associated source code (for example, a binary type). * - * @see #TRUE - * @see #FALSE - * @see ToolFactory#createCodeFormatter(Map, int) - * @since 3.6 - */ -</pre> -<p>For example, the following snippet:</p> -<pre> -public class X01 { -// int a = 1; -// int b = 2; -} -</pre> -will be untouched by the formatter if both options are activated. -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=251133">251133</a> for more details. -</li> -<li>New API to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=252431">252431</a>. See the bug for details. -<pre> -org.eclipse.jdt.core.IClasspathEntry - /** - * Returns the classpath entry that is making a reference to this classpath entry. For entry kinds - * {@link #CPE_LIBRARY}, the return value is the entry that is representing the JAR that includes - * <code>this</code> in the MANIFEST.MF file's Class-Path section. For entry kinds other than - * {@link #CPE_LIBRARY}, this returns <code>null</code>. For those entries that are on the raw classpath already, - * this returns <code>null</code>. - * - * It is possible that multiple library entries refer to the same entry - * via the MANIFEST.MF file. In those cases, this method returns the first classpath entry - * that appears in the raw classpath. However, this does not mean that the other referencing - * entries do not relate to their referenced entries. - * See {@link JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject)} for - * more details. - * - * @return the classpath entry that is referencing this entry or <code>null</code> if - * not applicable. - * @since 3.6 - */ - IClasspathEntry getReferencingEntry(); - - -org.eclipse.jdt.core.IJavaProject - /** - * Works similar to {@link #setRawClasspath(IClasspathEntry[], IPath, IProgressMonitor)} and - * additionally allows persisting the given array of referenced entries for this project. - * The referenced entries and their attributes are stored in the .classpath file of this - * project. For details on referenced entries, see - * {@link JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject)} - * and {@link IClasspathEntry#getReferencingEntry()}. - * - * Since the referenced entries are stored in the .classpath file, clients can store additional - * information that belong to these entries and retrieve them across sessions, though the referenced - * entries themselves may not be present in the raw classpath. By passing a <code>null</code> - * referencedEntries, clients can choose not to modify the already persisted referenced entries, - * which is fully equivalent to {@link #setRawClasspath(IClasspathEntry[], IPath, IProgressMonitor)}. - * If an empty array is passed as referencedEntries, the already persisted referenced entries, - * if any, will be cleared. - * - * If there are duplicates of a referenced entry or if any of the <code>referencedEntries</code> - * is already present in the raw classpath(<code>entries</code>) those referenced entries will - * be excluded and not be persisted. - * - * @param entries a list of classpath entries - * @param referencedEntries the list of referenced classpath entries to be persisted - * @param outputLocation the default output location - * @param monitor the given progress monitor - * @exception JavaModelException if the classpath could not be set. Reasons include: - * This Java element does not exist (ELEMENT_DOES_NOT_EXIST) - * The classpath is being modified during resource change event notification (CORE_EXCEPTION) - * The classpath failed the validation check as defined by {@link JavaConventions#validateClasspath(IJavaProject, IClasspathEntry[], IPath)} - * @see IClasspathEntry - * @see #getReferencedClasspathEntries() - * @since 3.6 - */ - void setRawClasspath(IClasspathEntry[] entries, IClasspathEntry[] referencedEntries, IPath outputLocation, - IProgressMonitor monitor) throws JavaModelException; - - /** - * Returns the list of referenced classpath entries stored in the .classpath file of <code>this</code> - * java project. Clients can store the referenced classpath entries using - * {@link #setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, IProgressMonitor)} - * If the client has not stored any referenced entries for this project, an empty array is returned. - * - * @throws JavaModelException - * @return an array of referenced classpath entries stored for this java project or an empty array if none - * stored earlier. - * @since 3.6 - */ - IClasspathEntry[] getReferencedClasspathEntries() throws JavaModelException; - - -org.eclipse.jdt.core.IPackageFragmentRoot - /** - * Returns the first resolved classpath entry that corresponds to this package fragment root. - * A resolved classpath entry is said to correspond to a root if the path of the resolved - * entry is equal to the root's path. - * - * @return the first resolved classpath entry that corresponds to this package fragment root - * @throws JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. - * @since 3.6 - */ - IClasspathEntry getResolvedClasspathEntry() throws JavaModelException; - - -org.eclipse.jdt.core.JavaCore - /** - * Returns an array of classpath entries that are referenced directly or indirectly - * by a given classpath entry. For the entry kind {@link IClasspathEntry#CPE_LIBRARY}, - * the method returns the libraries that are included in the Class-Path section of - * the MANIFEST.MF file. If a referenced JAR file has further references to other library - * entries, they are processed recursively and added to the list. For entry kinds other - * than {@link IClasspathEntry#CPE_LIBRARY}, this method returns an empty array. - * - * If a referenced entry has already been stored - * in the given project's .classpath, the stored attributes are populated in the corresponding - * referenced entry. For more details on storing referenced entries see - * see {@link IJavaProject#setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, - * IProgressMonitor)}. - * - * @param libraryEntry the library entry whose referenced entries are sought - * @param project project where the persisted referenced entries to be retrieved from - * @return an array of classpath entries that are referenced directly or indirectly by the given entry. - * If not applicable, returns an empty array. - * @since 3.6 - */ - public static IClasspathEntry[] getReferencedClasspathEntries(IClasspathEntry libraryEntry, IJavaProject project); -</pre> -</li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=252431">252431</a> -New API is needed to better identify referenced jars in the Class-Path: entry -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=251133">251133</a> -[formatter] Automatic formatting single line comments is incoherent among tools -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=248897">248897</a> -[1.5][compiler] Wrong warning 'The local variable 'var' is never read'. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031">304031</a> -Unused @SuppressWarnings(..) not flagged when suppressed problem is set to Error -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551">295551</a> -Add option to automatically promote all warnings to errors -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303810">303810</a> -Compact boolean fields on FlowContext -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=251227">251227</a> -[compiler] Fup of bug 115814, comparing doubles should not be flagged -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=268798">268798</a> -[1.5][compiler] Eclipse 3.5M5/6 produces new compiler errors with generics -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448">303448</a> -Wrong code generation optimization when assert condition is false -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303776">303776</a> -Member types imports are removed too aggressively -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302949">302949</a> -JavaModelManager hangs accessing the nonChainingJars set -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=246594">246594</a> -[model] API request: ITypeParameter#getBoundsSignatures() or #getSignature() -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=253896">253896</a> -[compiler][null] wrong "Null comparison always yields false" problem for auto-unboxing -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284789">284789</a> -[formatter] Does not line-break method declaration exception with parameters -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303480">303480</a> -[1.5][compiler] CCE: org.eclipse.jdt.internal.compiler.parser.RecoveredBlock cannot be cast to org.eclipse.jdt.internal.compiler.parser.RecoveredType - -<a name="v_A36"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M6 - February 23, 2010 -<br>Project org.eclipse.jdt.core v_A36 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A36">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li> -Added a new formatter preferences to align annotation arguments (i.e. element-value pairs). -<p> -This new preference is controlled with the option:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION</code> -<pre> -/** - * FORMATTER / Option for alignment of arguments in annotation - * - option id: "org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" - * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call - * - default: createAlignmentValue(false, WRAP_NO_SPLIT, INDENT_DEFAULT) - * - * @see #createAlignmentValue(boolean, int, int) - * @since 3.6 - */ -</pre> -<p>For example, the following snippet:</p> -<pre> -@MyAnnot(value1 = "this is an example", value2 = "of an annotation", value3 = "with several arguments", value4 = "which may need to be wrapped") -public class Test { -} -</pre> -formatted with this preference activated, will produce the following output -while using the <code>Eclipse [built-in]</code> profile: -<pre> -@MyAnnot(value1 = "this is an example", value2 = "of an annotation", - value3 = "with several arguments", - value4 = "which may need to be wrapped") -public class Test { -} -</pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282030">282030</a> for more details. -</li> -<li>In order to get bindings outside the Eclipse environment, the following methods has been added on the ASTParser class. -<br>See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=206391">206391</a> for details.<br> -<pre> -org.eclipse.jdt.core.dom.ASTParser - /** - * Set the environment that can be used when no IJavaProject are available. - * - * The user has to be sure to include all required types on the classpaths for binary types - * or on the sourcepaths for source types to resolve the given source code. - * All classpath and sourcepath entries are absolute paths. - * If sourcepaths contain units using a specific encoding (not the platform encoding), then the - * given encodings must be set. If the given encodings is set, its length must - * match the length of the sourcepaths parameter or an IllegalArgumentException will be thrown. - * If encodings is not null, the given sourcepathEntries must not be null. - * - * @param classpathEntries the given classpath entries to be used to resolve bindings - * @param sourcepathEntries the given sourcepath entries to be used to resolve bindings - * @param encodings the encodings of the corresponding sourcepath entries or null if the platform encoding - * can be used. - * @param includeRunningVMBootclasspath true if the bootclasspath of the running VM must be prepended to the - * given classpath and false if the bootclasspath of the running VM should be ignored. - * @throws IllegalArgumentException if the size of the given encodings is not equals to the size of the given - * sourcepathEntries - * @since 3.6 - */ - public void setEnvironment(String[] classpathEntries, String[] sourcepathEntries, String[] encodings, boolean includeRunningVMBootclasspath); - - /** - * Creates ASTs for a batch of compilation units. When bindings are being resolved, processing a - * batch of compilation units is more efficient because much of the work involved in resolving - * bindings can be shared. - * - * When bindings are being resolved, all compilation units are resolved - * using the same environment, which must be set beforehand with - * {@link #setEnvironment(String[], String[], String[], boolean) setEnvironment}. - * The compilation units are processed one at a time in no specified order. - * For each of the compilation units in turn, - * - {@link ASTParser#createAST(IProgressMonitor) ASTParser.createAST} is called to parse it - * and create a corresponding AST. The calls to {@link ASTParser#createAST(IProgressMonitor) ASTParser.createAST} - * all employ the same settings.</li> - * - {@link FileASTRequestor#acceptAST(String, CompilationUnit) FileASTRequestor.acceptAST} is called passing - * the compilation unit path and the corresponding AST to <code>requestor</code>. The compilation unit path is the same - * path that is passed into the given <code>sourceFilePaths</code> parameter. - * - * Note only ASTs from the given compilation units are reported - * to the requestor. If additional compilation units are required to - * resolve the original ones, the corresponding ASTs are <b>not</b> - * reported to the requestor. - * - * Note also the following parser parameters are used, regardless of what - * may have been specified: - * - The {@linkplain #setKind(int) parser kind} is <code>K_COMPILATION_UNIT</code> - * - The {@linkplain #setSourceRange(int,int) source range} is <code>(0, -1)</code> - * - The {@linkplain #setFocalPosition(int) focal position} is not set - * - * The <code>bindingKeys</code> parameter specifies bindings keys - * ({@link IBinding#getKey()}) that are to be looked up. These keys may - * be for elements either inside or outside the set of compilation - * units being processed. When bindings are being resolved, - * the keys and corresponding bindings (or <code>null</code> if none) are - * passed to {@link FileASTRequestor#acceptBinding(String, IBinding) FileASTRequestor.acceptBinding}. Note that binding keys - * for elements outside the set of compilation units being processed are looked up - * after all {@link FileASTRequestor#acceptAST(String, CompilationUnit) ASTRequestor.acceptAST} - * callbacks have been made. - * Binding keys for elements inside the set of compilation units being processed - * are looked up and reported right after the corresponding - * {@link FileASTRequestor#acceptAST(String, CompilationUnit) FileASTRequestor.acceptAST} callback has been made. - * No {@link FileASTRequestor#acceptBinding(String, IBinding) FileASTRequestor.acceptBinding} callbacks are made unless - * bindings are being resolved. - * - * A successful call to this method returns all settings to their - * default values so the object is ready to be reused. - * - * The given <code>encodings</code> are used to properly parse the given source units. If the platform encoding is sufficient, - * then the given encodings can be set to <code>null</code>. - * - * @param sourceFilePaths the compilation units to create ASTs for - * @param encodings the given encoding for the source units - * @param bindingKeys the binding keys to create bindings for - * @param requestor the AST requestor that collects abstract syntax trees and bindings - * @param monitor the progress monitor used to report progress and request cancellation, - * or <code>null</code> if none - * @exception IllegalStateException if the settings provided - * are insufficient, contradictory, or otherwise unsupported - * @since 3.6 - */ - public void createASTs(String[] sourceFilePaths, String[] encodings, String[] bindingKeys, FileASTRequestor requestor, IProgressMonitor monitor) -</pre> -</li> -<li> -Added two new formatter preferences to condense block and javadoc comments. -<p> -These new preferences are controlled respectively with the options:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES</code><br> -<code>DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES</code> -<pre> -/** - * FORMATTER / Option to control whether block comments will have new lines at boundaries - * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" - * - possible values: { TRUE, FALSE } - * - default: TRUE + * If this element is an IImportDeclaration, the source range + * of this import declaration's name, or null if this import + * declaration does not have associated source code (for example, a binary type). + * The source range for the name includes the trailing '*' if the call to + * IImportDeclaration#isOnDemand() returns true. + * + * If this element is an IPackageDeclaration, the source range of + * this package declaration's name, or null if this package + * declaration does not have associated source code (for example, a binary type). + * + * If this element is an IAnnotation, the source range of + * this annotation's name, or null if this annotation does not have + * associated source code (for example, in a binary type). * - * @see #TRUE - * @see #FALSE - * @since 3.6 - */ - -/** - * FORMATTER / Option to control whether javadoc comments will have new lines at boundaries - * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" - * - possible values: { TRUE, FALSE } - * - default: TRUE + * If this element is an ITypeParameter, the source range of this + * type parameter's name, or null if this type parameter does not have + * associated source code (for example, in a binary type). * - * @see #TRUE - * @see #FALSE - * @since 3.6 - */ - </pre> -<p>For example, the following snippet:</p> -<pre> -public class X { - /* - * This block comment after formatting will no longer use a new line - * at the beginning and at the end of the comment... - */ - void foo() { - } - /** - * This javadoc comment after formatting will no longer use a new line - * at the beginning and at the end of the comment... - */ - void bar() { - } -} -</pre> -formatted with both the options set to FALSE, will produce the following output: -<pre> -public class X { - /* This block comment after formatting will no longer use a new line at the - * beginning and at the end of the comment... */ - void foo() { - } - - /** This javadoc comment after formatting will no longer use a new line at - * the beginning and at the end of the comment... */ - void bar() { - } -} -</pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270209">270209</a> for more details. -</li> -<li> -The <code>CodeFormatter.F_INCLUDE_COMMENT</code> flag now works for all kind -of snippet while using the formatter.<br> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236406">236406</a> for more details. -</li> -<li> -Added a new formatter preferences to insert a new line after a label. -<p> -This new preference is controlled with the option:</p> -<code>DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL</code> -<pre> -/** - * FORMATTER / Option to insert a new line after a label - * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_label" - * - possible values: { INSERT, DO_NOT_INSERT } - * - default: DO_NOT_INSERT + * If this element is an ITypeRoot or IImportContainer, it + * returns null. + * + * @return the name range associated with this element, or null if + * not available * - * @see JavaCore#INSERT - * @see JavaCore#DO_NOT_INSERT - * @since 3.6 + * @since 3.7 */ +ISourceRange getNameRange() throws JavaModelException; </pre> -<p>For example, the following snippet:</p> -<pre> -public class X { - void foo() { - LABEL:for (int i = 0; i < 10; i++) { - } - } -} -</pre> -formatted with this preference activated, will produce the following output: -<pre> -public class X { - void foo() { - LABEL: - for (int i = 0; i < 10; i++) { - } - } -} -</pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=150741">150741</a> for more details. </li> </ul> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298362">298362</a> -[1.5][compiler] Compiler returns java.lang.Object instead of generic type T when javac returns T -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281655">281655</a> -[formatter] "Never join lines" does not work for annotations. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282030">282030</a> -[formatter] Java annotation formatting -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270209">270209</a> -[format] Condensed block comment formatting -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236406">236406</a> -[formatter] The comments flags should work for all kinds of snippet -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294360">294360</a> -Duplicate entries in Classpath Resolution when importing dependencies from parent project -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=206391">206391</a> -[DOM] Binding Resolutions for projects outside of Eclipse workspace -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=150409">150409</a> -[compiler] AST does not expose method bindings for non-visible inherited field -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302358">302358</a> -Compiler finds wrong method for method invocation with generics -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302919">302919</a> -misreported cast Error when mixing generic and raw class in nested class -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=150741">150741</a> -[formatter] Add option: "add new line after label" -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287939">287939</a> -[code assist] The instanceof and the auto cast feature should also work for an assignment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303108">303108</a> -[import rewrite] ImportRewrite#removeImport(String) does not work with setUseContextToFilterImplicitImports(true) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295619">295619</a> -Test failure caused by a timing issue in M20091118-0800 +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322979">322979</a> +[search] use of IJavaSearchConstants.IMPLEMENTORS yields surprising results +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937">316937</a> +JavaElement.getElementInfo(..) throws JavaModelException when trying to get info for an inner class in an external jar +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322531">322531</a> +[1.5][Generics] eclipse compiles code rejected by javac with incomparable types error. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308000">308000</a> +[formatter] Formatter is missing options regarding Annotation Newlines +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321276">321276</a> +JDT core apis dont recognize InnerClass constructor inside .class files +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=252556">252556</a> +[formatter] Spaces removed before formatted region of a compilation unit. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785">323785</a> +[builder] NPE when adding 'package-info.java' to default package +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321358">321358</a> +NPE refreshing external folders +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322596">322596</a> +[DOM] ASTNode APIs should specify types of property descriptors +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=324109">324109</a> +[search] Java search shows incorrect results as accurate matches +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=324154">324154</a> +NPE in FlowContext while building +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=133125">133125</a> +[compiler][null] need to report the null status of expressions and analyze them simultaneously +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321695">321695</a> +Test added for bug 319425 doesn't detect the bug +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=258905">258905</a> +making java.lang.AssertionError accessible thru resolveWellKnownType method +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321764">321764</a> +Add getNameRange() to ISourceReference -<a name="v_A35"></a> +<a name="v_B09"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M6 - February 16, 2010 -<br>Project org.eclipse.jdt.core v_A35 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A35">cvs</a>). +Eclipse SDK 3.7M2 - August 31, 2010 - 3.7.0 M2 +<br>Project org.eclipse.jdt.core v_B09 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B09">cvs</a>). <h2>What's new in this drop</h2> -<ul> -<li>In order to fix bugs <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235253">235253</a> and -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=194358">194358</a>, a new API was added to preserve the existing pre-3.6 behavior for existing clients:<br> -<pre> - /** - * Sets whether a context should be used to properly filter implicit imports. - * - * By default, the option is disabled to preserve pre-3.6 behavior. - * - * - * When this option is set, the context passed to the addImport*(...) methods is used to determine - * whether an import can be filtered because the type is implicitly visible. Note that too many imports - * may be kept if this option is set and addImport*(...) methods are called without a context. - * - * - * @param useContextToFilterImplicitImports the given setting - * - * @see #setFilterImplicitImports(boolean) - * @since 3.6 - */ - public void setUseContextToFilterImplicitImports(boolean useContextToFilterImplicitImports); -</pre> -</li> -</ul> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302455">302455</a> -java.lang.ClassCastException in secondary types removal -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=102279">102279</a> -[search] method reference performance depends on method name -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236814">236814</a> -[jsr199] EclipseCompiler#getTask does not respect its contract when its first argument is null -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302552">302552</a> -[formatter] Formatting qualified invocations can be broken when the Line Wrapping policy forces element to be on a new line -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302587">302587</a> -Encoding/decoding of problem arguments in Marker fails if argument contains # -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=301438">301438</a> -Eclipse hangs when attempting to refactor using the "change method signature" -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=260381">260381</a> -[formatter] Javadoc formatter breaks {@code ...} tags. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302446">302446</a> -[compiler] Regression in if statement flow analysis related to null checks -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=194358">194358</a> -[import rewrite] Organize Imports produces wrong order of imports -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235253">235253</a> -[organize imports] Organize imports removes needed import statement. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302379">302379</a> -[search] JavaSearchTests.testZIPArchive2() test failed in I20100209-0800 +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311578">311578</a> +[formatter] Enable/disable tag detection should include comment start/end tokens +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320618">320618</a> +inconsistent initialization of classpath container backed by external class folder +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=323693">323693</a> +[1.5][compiler] Compiler fails to diagnose name clash +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=323558">323558</a> +Tests test0307a and test0307e under BatchCompilerTest failing +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308402">308402</a> +[index] PatternSearchJob ignores participant index entries +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264">317264</a> +[search] Refactoring is impossible with commons.lang added to project -<a name="v_A34"></a> +<a name="v_B08"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M6 - February 9, 2010 -<br>Project org.eclipse.jdt.core v_A34 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A34">cvs</a>). +Eclipse SDK 3.7M1 - August 24, 2010 +<br>Project org.eclipse.jdt.core v_B08 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B08">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302123">302123</a> -[formatter] AssertionFailedException occurs while formatting a source containing the specific javadoc comment /** ***/ -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379">300379</a> -[formatter] Fup of bug 287833 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=250056">250056</a> -[compiler][null] Another assert and "Redundant null check" -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=301683">301683</a> -Annotations are broken when native methods are present in a class -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300734">300734</a> -Extract temp misses duplicate occurrence. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289560">289560</a> -Eclipse hangs after modifying user libraries -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=301562">301562</a> -[JSR269] Error in EclipseFileManager.collectAllMatchingFiles -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298637">298637</a> -Could not retrieve declared methods (NPE in ParameterizedTypeBinding.resolve) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057">294057</a> -[1.5][compiler] Imports not resolved correctly with generics and inner interfaces +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926">321926</a> +Erroneously deems null check conditional branch to be dead code, and produces incorrect bytecode +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320170">320170</a> +[compiler] [null] Whitebox issues in null analysis +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259">305259</a> +Strange error when referencing code produced with jsr14 target +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321115">321115</a> +Compiler is not case sensitive with package names +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427">310427</a> +[content assist] FUP of 236306: Variable proposed before definition. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320911">320911</a> +Not all redundant superinterface problems reported -<a name="v_A33"></a> +<a name="v_B07"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M6 - February 2, 2010 -<br>Project org.eclipse.jdt.core v_A33 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A33">cvs</a>). +Eclipse SDK 3.7M1 - August 17, 2010 +<br>Project org.eclipse.jdt.core v_B07 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B07">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136">300136</a> -classpathentry OPTIONAL attribute not honored for var entries -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300723">300723</a> -Fup of bug 235783 +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=319201">319201</a> +[null] no warning when unboxing SingleNameReference causes NPE +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322154">322154</a> +Compiler bug that does not occur in Galileo 3.5.2 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320754">320754</a> +[formatter] formatter:off/on tags does not work correctly +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=322001">322001</a> +[1.5][compiler] Name Clash error occurs -<a name="v_A32a"></a> +<a name="v_B06"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M5 - January 21, 2010 - 3.6.0 M5 -<br>Project org.eclipse.jdt.core v_A32a -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A32a">cvs</a>). +Eclipse SDK 3.7M1 - August 10, 2010 +<br>Project org.eclipse.jdt.core v_B06 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B06">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300133">300133</a> -[1.5][compiler] Local classes inside enum constants generate default constructor without implicit constructor call -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300440">300440</a> -icu dependency needs to be udpated -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=299900">299900</a> -[null]Missing potential null warnings for variable on the right of an OR conditional expression -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293917">293917</a> -Invalid 'potential null access' warning reports -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=252379">252379</a> -Organize imports deletes needed static import. +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320167">320167</a> +Auto-Activation works only once +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320809">320809</a> +ArrayIndexOutOfBoundsException in IndexManager.writeSavedIndexNamesFile - concurrency issue? +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=321085">321085</a> +Enhanced for loops need to implement type safety checks on array initializers +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=319626">319626</a> +Preferences->Java Compiler-> Errors/Warnings -> Undocumented Empty Block -<a name="v_A31"></a> +<a name="v_B05"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M5 - January 18, 2010 -<br>Project org.eclipse.jdt.core v_A31 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A31">cvs</a>). +Eclipse SDK 3.7M1 - July 30, 2010 - 3.7.0 M1 +<br>Project org.eclipse.jdt.core v_B05 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B05">cvs</a>). <h2>What's new in this drop</h2> <ul> -<li>New API to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894">295894</a>. See the bug for details. +<li> +New API added to be able to retrieve the name range for <code>org.eclipse.jdt.core.IImportDeclaration</code>: <pre> /** - * Returns a Java search scope limited to the hierarchy of the given type and to a given project. - * The Java elements resulting from a search with this scope will be types in this hierarchy. - * - * Unlike the createHierarchyScope methods, this method creates strict - * scopes that only contain types that actually span the hierarchy of the focus - * type, but do not include additional enclosing or member types. - * - * - * By default, hierarchy scopes include all direct and indirect supertypes and subtypes of the - * focus type. This method, however, allows to restrict the hierarchy to true subtypes, - * not including supertypes. Also inclusion of the focus type itself is controled by a parameter. - * + * Returns the source range of this import declaration's name, + * or null if this import declaration does not have + * associated source code (for example, a binary type). + * + * The source range for the name includes the trailing '*' if the call to + * isOnDemand() returns true. * - * @param project the project to which to constrain the search, or null if - * search should consider all types in the workspace - * @param type the focus of the hierarchy scope - * @param onlySubtypes if true only subtypes of type are considered - * @param includeFocusType if true the focus type type is included in the resulting scope, - * otherwise it is excluded - * @param owner the owner of working copies that take precedence over original compilation units, - * or null if the primary working copy owner should be used - * @return a new hierarchy scope - * @exception JavaModelException if the hierarchy could not be computed on the given type - * @since 3.6 - */ -public static IJavaSearchScope createStrictHierarchyScope(IJavaProject project, IType type, boolean onlySubtypes, boolean includeFocusType, WorkingCopyOwner owner) throws JavaModelException; -</pre> -</li> -<li>New API added to report a compiler warning when object allocations are unused: -<pre> -org.eclipse.jdt.core.compiler.IProblem.UnusedObjectAllocation - -/** - * Compiler option ID: Reporting Allocation of an Unused Object. - * When enabled, the compiler will issue an error or a warning if an object is allocated but never used, - * neither by holding a reference nor by invoking one of the object's methods. - * - * Option id:"org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation" - * Possible values:{ "error", "warning", "ignore" } - * Default:"ignore" - * - * @since 3.6 - * @category CompilerOptionID - */ -public static final String COMPILER_PB_UNUSED_OBJECT_ALLOCATION = PLUGIN_ID + ".compiler.problem.unusedObjectAllocation"; -</pre> -</li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=245007">245007</a> -[compiler] Should not completely ignore anonymous type with missing super type -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894">295894</a> -[search] Search shows focus type implementation for nested types even though the scope is restricted to subtypes. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236385">236385</a> -[compiler] Warn for potential programming problem if an object is created but not used - -<a name="v_A30"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M5 - January 12, 2010 -<br>Project org.eclipse.jdt.core v_A30 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A30">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>New API added to expose the reconcile flags used in the reconcile context: -<pre> -/** - * Returns the reconcile flag of this context. This flag is a bitwise value of the constant defined - * in ICompilationUnit. - * - * @return the reconcile flag of this context - * @since 3.6 * - * @see ICompilationUnit#ENABLE_BINDINGS_RECOVERY - * @see ICompilationUnit#ENABLE_STATEMENTS_RECOVERY - * @see ICompilationUnit#IGNORE_METHOD_BODIES + * @exception JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource. + * @return the source range of this import declaration's name, + * or null if this import declaration does not have + * associated source code (for example, a binary type) + * @since 3.7 */ -public int getReconcileFlags(); +ISourceRange getNameRange() throws JavaModelException; </pre> </li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=243917">243917</a> -[compiler] should not warn about unused field when native method present -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296343">296343</a> -OOM error caused by java indexing referencing classloader from threadLocal -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=130000">130000</a> -[API] ReconcileContext API: Does getAST3 return AST with bindings? -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298238">298238</a> -Unresolved import in superclass causes 'Cannot reduce the visibility of the inherited method' in subclass - -<a name="v_A29a"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M5 - January 5, 2010 -<br>Project org.eclipse.jdt.core v_A29a -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A29a">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293861">293861</a> -Problem with refactoring when existing jar with invalid package names -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=264112">264112</a> -[Formatter] Wrap when necessary too aggressive on short qualifiers -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298250">298250</a> -[1.6][compiler] NegativeArraySizeException in StackMapFrame.duplicate -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296998">296998</a> -Unused imports should not prevent execution -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298243">298243</a> -[formatter] Removing empty lines between import groups -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297546">297546</a> -[formatter] Formatter removes blank after @see if reference is wrapped -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235781">235781</a> -[compiler] difference to javac in definite unassignment analysis involving an exception within a constructor -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235783">235783</a> -[eval] CodeSnippetParser and some 'CodeSnippet*' ast node does not seem up to date - -<a name="v_A28"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M5 - December 14, 2009 -<br>Project org.eclipse.jdt.core v_A28 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A28">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=196714">196714</a> -[comment] InvalidInputException prevents the AbstractCommentMapper to retrieve tag element -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297757">297757</a> -Cannot get bindings for IType corresponding to parameterized anonymous type -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=255640">255640</a> -[spec] Methods Signature.toCharArray(..) have unclear precondition -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=262898">262898</a> -BufferChangedEvent must not have @noinstantiate -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=181682">181682</a> -JavaConventions.validateJavaTypeName should list valid constants -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=108784">108784</a> -SourceMapper doesn't find name range of inner class constructors - -<a name="v_A27"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M4 - December 8, 2009 - 3.6.0 M4 -<br>Project org.eclipse.jdt.core v_A27 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A27">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297225">297225</a> -[formatter] Indentation may be still wrong in certain circumstances after formatting -<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293697">293697</a> -JavaSearchBugTests.testBug286379c is failing randomly - -<a name="v_A26"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M4 - December 7, 2009 -<br>Project org.eclipse.jdt.core v_A26 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A26">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297045">297045</a> -Weird tests failures in N20091204-2000 and N20091205-2000 builds -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293300">293300</a> -[formatter] The formatter is still unstable in certain circumstances - -<a name="v_A25"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M4 - December 4, 2009 -<br>Project org.eclipse.jdt.core v_A25 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A25">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>Match result can now report the access rules through a new API added on <code>TypeNameMatch</code>: +<li> +New API added to be able to retrieve the name range for <code>org.eclipse.jdt.core.IPackageDeclaration</code>: <pre> /** - * Returns the accessibility of the type name match - * - * @see IAccessRule - * - * @return the accessibility of the type name which may be - * {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED} - * or {@link IAccessRule#K_NON_ACCESSIBLE}. - * The default returned value is {@link IAccessRule#K_ACCESSIBLE}. + * Returns the source range of this package declaration's name, + * or null if this package declaration does not have + * associated source code (for example, a binary type). * - * @since 3.6 + * @exception JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource. + * @return the source range of this package declaration's name, + * or null if this package declaration does not have + * associated source code (for example, a binary type) + * @since 3.7 */ -public abstract int getAccessibility(); -</pre> -See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296277">296277</a> for more details. -</li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296277">296277</a> -[search] SearchEngine#searchAllTypeNames(.., TypeNameMatchRequestor,..) should report access rules -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296708">296708</a> -[DOM/AST] clarify setters when createASTs(..) is used -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296629">296629</a> -[quick fix] Cast quick fix not offered for method-local classes -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295948">295948</a> -ElementImpl.hashCode throws an NPE -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296660">296660</a> -[compiler] Incorrect unused method warning from compiler - -<a name="v_A24"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M4 - December 1, 2009 -<br>Project org.eclipse.jdt.core v_A24 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A24">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>New API added to ignore method bodies inside AST tree. The new APIs are tagged as 3.5.2 as this code -will be backported to 3.5.2: -<pre> -org.eclipse.jdt.core.dom.ASTParser: - /** - * Requests an abstract syntax tree without method bodies. - * - * When ignore method bodies is enabled, all method bodies are discarded. - * This has no impact on the binding resolution. - * - * If a method contains local types, its method body will be retained. - * This settings is not used if the kind used in setKind(int) is either - * K_EXPRESSION or K_STATEMENTS. - * @since 3.5.2 - */ - public void setIgnoreMethodBodies(boolean enabled); - -org.eclipse.jdt.core.ICompilationUnit: - /** - * Constant indicating that a reconcile operation could ignore to parse the method bodies. - * @see ASTParser#setIgnoreMethodBodies(boolean) - * @since 3.5.2 - */ - public static final int IGNORE_METHOD_BODIES = 0x08; - +ISourceRange getNameRange() throws JavaModelException; </pre> </li> </ul> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288174">288174</a> -[search] NullPointerException when searching for type references -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643">277643</a> -Generics compile error -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288211">288211</a> -APT uses a lot of memory +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306524">306524</a> +ASTRewriteAnalyzer uses wrong starting offset in case of comments before a node +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=150980">150980</a> +[API] Selecting import declaration with space in outline highlights wrong range +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320841">320841</a> +TypeConverters don't set enclosingType +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320802">320802</a> +ASTParser.createASTs(..) fails silently on multiple missing parameter types. -<a name="v_A23"></a> +<a name="v_B04"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M4 - November 24, 2009 -<br>Project org.eclipse.jdt.core v_A23 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A23">cvs</a>). +Eclipse SDK 3.7M1 - July 27, 2010 +<br>Project org.eclipse.jdt.core v_B04 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B04">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295698">295698</a> -[1.5][compiler] ClassCastException in unchecked warning report -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295260">295260</a> -Wrong warnings on Java.Compiler.Errors/Warnings "Redundant null check" -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=190737">190737</a> -[compiler][null] missing 'cannot be null' warning within for loop +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=319425">319425</a> +[compiler] JDT outputs corrupt .class file for problem type +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885">319885</a> +Spurious 'cycle detected'/'hierarchy inconsistent' errors if a type that WOULD be cyclic is static-imported +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=312076">312076</a> +[1.5][compiler] Eclipse compiler behaves differently from javac +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320414">320414</a> +Compiler produces incorrect bytecode for null pointer check +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=223225">223225</a> +[DOM] IMemberValuePairBinding does not desugar single values into one-element arrays +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=319603">319603</a> +[1.5][compiler] eclipse fails with 2 generics methods with the same name while javac succeeds +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=318020">318020</a> +[compiler] wrong initialization flow info with if (true) throw... pattern in else block -<a name="v_A22"></a> +<a name="v_B03"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M4 - November 16, 2009 -<br>Project org.eclipse.jdt.core v_A22 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A22">cvs</a>). +Eclipse SDK 3.7M1 - July 20, 2010 +<br>Project org.eclipse.jdt.core v_B03 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B03">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=153429">153429</a> -JUnit4 in Eclipse Testing Framework -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295238">295238</a> -[formatter] The comment formatter add an unexpected new line in block comment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295175">295175</a> -[formatter] Missing space before a string at the beginning of a line in a javadoc comment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294529">294529</a> -The Scanner sometimes ignores the given offset if larger than the EOF. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294662">294662</a> -ClassCastException while invoking quick assist -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294404">294404</a> --target jsr14 flags error on foreach over Collection that does not implement Iterable -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293955">293955</a> -valid javadoc url set on user library, but still says no javadoc -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293443">293443</a> -AbortCompilation when invoking content assist -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293711">293711</a> -Clarify ICompilationUnit#getOwner() javadoc -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293615">293615</a> -error message since v3.6.0M2: name clash by overriding generic methods -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294618">294618</a> -[formatter] The formatter fails to format a compilation unit with deep nesting of html tags -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=248312">248312</a> -[model] IMemberValuePair#getValue() should also work for negative numerals -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294731">294731</a> -Specify value type of JAVADOC_LOCATION_ATTRIBUTE_NAME +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=320340">320340</a> +Test failures in debug mode +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307523">307523</a> +Differences between patch of bug 210422 and sources +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=319900">319900</a> +StringLiteral#setLiteralValue needlessly escapes apostrophes (') +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310264">310264</a> +Wrong warning: The assignment to variable has no effect -<a name="v_A21"></a> +<a name="v_B02"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M4 - November 10, 2009 -<br>Project org.eclipse.jdt.core v_A21 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A21">cvs</a>). +Eclipse SDK 3.7M1 - July 13, 2010 +<br>Project org.eclipse.jdt.core v_B02 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B02">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294631">294631</a> -[formatter] The formatter takes two passes to format a common sequence of html tags -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294500">294500</a> -[formatter] MalformedTreeException when formatting an invalid sequence of <code> tags in a javadoc comment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294488">294488</a> -Javadoc of ISourceReference#getSourceRange() should link to SourceRange#isAvailable(..) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=199265">199265</a> -[formatter] 3.3 Code Formatter mis-places commented-out import statements -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=241549">241549</a> -[spec] IType#getFields/Initializers/Methods() should define order from class file -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=275805">275805</a> -creating a non-primary working copy causes typeHierarchyChanged event -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292510">292510</a> -FUP of 292364: Error messages don't identify partial types precisely. +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556">314556</a> +[1.5][compiler] compiler fails to report attempt to assign weaker access privileges +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956">316956</a> +[compiler] Private superclass and enclosing scope field names incorrectly reported as conflicting +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=151500">151500</a> +[assist] Method parameter names are not displayed for inner classes +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304006">304006</a> +[code assist] Autocast after instanceof feature doesnt work in some cases. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=210419">210419</a> +[compiler] Invalid field initializer not flagged as error +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=212713">212713</a> +Bad error message for static block inside an interface -<a name="v_A20"></a> +<a name="v_B01"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M4 - November 3, 2009 -<br>Project org.eclipse.jdt.core v_A20 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A20">cvs</a>). +Eclipse SDK 3.7M1 - July 6, 2010 - 3.7M1 +<br>Project org.eclipse.jdt.core v_B01 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B01">cvs</a>). <h2>What's new in this drop</h2> <h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293384">293384</a> -Eclipse erroneously reports method "is ambiguous for type" -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002">285002</a> -[compiler] visibility error for package private method +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313153">313153</a> +Too many blocked "Refreshing external folders" jobs (FUP of bug 302295) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=316654">316654</a> +ITypeHierarchyChangedListener receive spurious callbacks +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=317858">317858</a> +Eclipse isn't accessing the correct field/class - causes compile error +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=318171">318171</a> +fieldHiding-Warning does not appear if classes are in different packages -<a name="v_A19"></a> +<a name="v_B00"></a> <hr><h1> Eclipse Platform Build Notes<br> Java development tools core</h1> -Eclipse SDK 3.6M3 - October 29, 2009 - 3.6M3 -<br>Project org.eclipse.jdt.core v_A19 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A19">cvs</a>). +Eclipse SDK 3.7M1 - June 29, 2010 +<br>Project org.eclipse.jdt.core v_B00 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_B00">cvs</a>). <h2>What's new in this drop</h2> -This version was created to tentatively fix bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293697">293697</a> -but it occurs again in subsequent build. So, it has been reopened and moved to next version... <h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841">317841</a> +[incremental build] unnecessary 'structural changes' due to annotation parameters +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=317468">317468</a> +Adding elements to an enum body with trailing comma generates bad code +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313668">313668</a> +[search] Call hierarchy doesn't show all calls of the method in workspace +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=317972">317972</a> +Fix for wrong usages of affect* and effect* +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313651">313651</a> +[formatter] format comments (differs between paste and save action) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=316889">316889</a> +Internal compiler error: java.lang.NullPointerException with a specific use of recursive generics +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=315978">315978</a> +Big regression, eclipse compiles my workspace in 3 mins instead of few seconds +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=315577">315577</a> +[formatter] No line break after <br> if followed by {@link when formatting java source file +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306464">306464</a> +NPE in ProblemReporter.missingTypeInMethod(ProblemReporter.java:5113) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=317212">317212</a> +[compiler] Illegal permission to invoke the constructor of a member class of an inaccessible type. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346">195346</a> +[assist] Array type should be filtered while completing in case of a switch +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=315732">315732</a> +[formatter] NullPointerException (always) on inserting a custom template proposal into java code when "Use code formatter" is on +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=316456">316456</a> +[1.5][compiler] Annotation values can access private class members +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=312989">312989</a> +Accepts illegal method-local classes if hidden by generics parameters +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310423">310423</a> +[content assist] After 'implements' annotation types should not be proposed +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=314830">314830</a> +[compiler] Switching on a null expression doesn't always throw NullPointerException +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313825">313825</a> +Erroneous local variable's problems reported at surrounding ParenthesizedExpression +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=314898">314898</a> +Typo in org.eclipse.jdt.core.dom.NameEnviromentWithProgress -<a name="v_A18"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - October 28, 2009 -<br>Project org.eclipse.jdt.core v_A18 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A18">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293496">293496</a> -Adding the serialVersionUID field doesn't work when tab size is 0 - -<a name="v_A17"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - October 26, 2009 -<br>Project org.eclipse.jdt.core v_A17 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A17">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>Reverted change for bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=263564">263564</a>.</li> -</ul> -<h3>Problem Reports Fixed</h3> - -<a name="v_A16"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - October 25, 2009 -<br>Project org.eclipse.jdt.core v_A16 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A16">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293240">293240</a> -[formatter] 'insert_space_before_opening_brace_in_array_initializer' preference may be reset in certain circumstances -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=263564">263564</a> -API to know when default compiler preference settings have been altered -<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=289385">289385</a> -Investigate comment in performance tests -<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=286379">286379</a> -[search] Problem while searching class - -<a name="v_A15"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - October 20, 2009 -<br>Project org.eclipse.jdt.core v_A15 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A15">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=292350">292350</a> -[1.5][compiler] Compiler error: ambiguous method since 3.5.1 using generics and interface inheritance -<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=292364">292364</a> -[internal] Type name in CastExpression not treated as Type name. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292428">292428</a> -Internal compiler error: NullPointerException at org.eclipse.jdt.internal.compiler.ast.CastExpression.checkUnsafeCast(CastExpression.java:333) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291985">291985</a> -[compiler][jsr14] Translating Enum with jsr14 target: ECJ causes a runtime error while Sun compiler works fine -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292240">292240</a> -Compiler error on implementation of raw sub interface - -<a name="v_A14"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - October 13, 2009 -<br>Project org.eclipse.jdt.core v_A14 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A14">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291391">291391</a> -update the Bundle-Version of the JDT Core Batch Compiler (ecj) from 3.3.0 to 3.6.* -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284280">284280</a> -[1.5][compiler] Error on use generic interface in abstract super class -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286228">286228</a> -[1.5][compiler] Generics inconsistencies possible regression -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286601">286601</a> -[formatter] Code formatter formats anonymous inner classes wrongly when 'Never join lines' is on -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=215139">215139</a> -[search] More options for HierarchyScope -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291472">291472</a> -[1.5][compiler] Access to a generic method is compiled incorrectly -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283539">283539</a> -NamingConventions.suggestVariableNames doesn't work if name contains '_' -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784">280784</a> -[batch] Allow access restrictions to be reported as errors - -<a name="v_A13"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - October 6, 2009 -<br>Project org.eclipse.jdt.core v_A13 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A13">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>Reverted fix for <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=106478">106478</a>.</li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291322">291322</a> -Test errors when running JDT Core tests on Windows 7 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282770">282770</a> -[compiler] Dead code detection should have specific @SuppressWarnings -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290028">290028</a> -Use IResource#setDerived(boolean, IProgressMonitor) instead of IResource#setDerived(boolean) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287607">287607</a> -[1.5][compiler] cast of inner of generic enclosing type are not reported as unsafe -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288749">288749</a> -Redundant superinterface not flagged inside one declaration -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290905">290905</a> -[formatter] Certain formatter pref constellation cause endless loop ==> OOME -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285124">285124</a> -serialVersionUID still causes error/warning -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290877">290877</a> -[DOM] If using a tag named '@enum' the ASTParser ignores this -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281575">281575</a> -Eclipse hangs in SourceMapper while doing java proposals -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290470">290470</a> -[JSR199][compiler] JDT compiler not jsr199 compatible. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290730">290730</a> -Rewriting SwitchStatement throws NPE - -<a name="v_A12"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - September 29, 2009 -<br>Project org.eclipse.jdt.core v_A12 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A12">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287676">287676</a> -[1.5][compiler] Useless cast warning not emited -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290563">290563</a> -add specification for fine grain search flags -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290376">290376</a> -Errant "Comparing identical expressions" warning with assignment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287592">287592</a> -[1.5][compiler] Wrong ambiguous compilation error -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290049">290049</a> -Reconciling a compilation unit does not return an AST with bindings when it should (probably) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290034">290034</a> -Effects of @SuppressWarnings("unchecked") are broader in Eclipse than in javac -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267561">267561</a> -[evaluation] LocalEvaluationEngine does not accept primitive types -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=163194">163194</a> -[1.6] compiler should warn about missing @Override annotation for interface method - -<a name="v_A11"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M3 - September 22, 2009 -<br>Project org.eclipse.jdt.core v_A11 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A11">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289892">289892</a> -[compiler] NPE during binaryTypeBinding field initialization -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833">287833</a> -[formatter] Formatter removes the first character after the * in the <pre> tag -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=238943">238943</a> -SortElementsOperation doesn't use project specific settings -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288621">288621</a> -[1.5][compiler] Creating type hierarchy failed when pressing F4 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289538">289538</a> -[1.5][compiler] compiler fails to generate correct code for private constructor in inner class -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289639">289639</a> -Problems opening perspective JavaPerspective, NPE on JavaModelManager.containersReset() -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289516">289516</a> -Annotations (visible and invisible) should be preserved with target jsr14 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289576">289576</a> -[1.5][compiler] Compiler changes 'private' modifier on methods with annotated parameter - -<a name="v_A10"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M2 - September 14, 2009 - 3.6M2 -<br>Project org.eclipse.jdt.core v_A10 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A10">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288148">288148</a> -[perfs] Comments applied for performance tests may be obsolete -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289247">289247</a> -[1.5][compiler]Detecting duplicate methods should not consider return type -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288920">288920</a> -[compiler] NPE renaming run() method -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288698">288698</a> -Cannot create type hierarchy for abstract types when they have inline descendants and *.class* in project name - -<a name="v_A09"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M2 - September 1, 2009 -<br>Project org.eclipse.jdt.core v_A09 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A09">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287009">287009</a> -Inner Annotation Checks are Missing -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287701">287701</a> -[dom] Length of Assignment should not include whitespace -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285230">285230</a> -[performance] Duplicate buffers created for internal classes -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286391">286391</a> -[compiler] jsr14 target behavior changed between ECJ 3.4.2 and ECJ 3.5 - -<a name="v_A08"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M2 - August 25, 2009 -<br>Project org.eclipse.jdt.core v_A08 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A08">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287462">287462</a> -[formatter] new failures in last 2 nightly builds -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285565">285565</a> -[inline] Inlining constant or local variables causes exceptions with tab width 0 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285799">285799</a> -HashtableOfObject rehashes and grows buffer on removeKey() -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286912">286912</a> -[formatter] Never join lines preferences makes the formatter unstable in certain circumstances -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286668">286668</a> -[formatter] 'Never Join Lines' joins lines that are split on method invocation -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=248661">248661</a> -Axis2: Missing required libraries in Axis 2 WS Client Projects -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286918">286918</a> -[javadoc] Compiler should warn when @see and @link tag references in package-info.java don't have fully qualified names -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285466">285466</a> -[3.5 regression] fails to build IcedTea, works with 3.4.x -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286956">286956</a> -NPE when asking to externalize constant -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609">281609</a> -[javadoc] "Javadoc: Invalid reference" warning for @link to Java package - -<a name="v_A07"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M2 - August 18, 2009 -<br>Project org.eclipse.jdt.core v_A07 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A07">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286840">286840</a> -ClasspathJar getPath() should return a unique path -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=254738">254738</a> -NPE in HierarchyResolver.setFocusType -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276294">276294</a> -Error does not go away after it is resolved -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284785">284785</a> -[1.5][compiler] Eclipse compiler shows error on javac-valid construct: varargs plus overload -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286405">286405</a> -Default value character of annotations in ClassFileEditor are badly printed -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286407">286407</a> -[Model] IMemberValuePair don't return the right value for java.lang.annotation.RetentionPolicy annotations -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285701">285701</a> -[1.5][compiler] Internal Compiler Error - ArrayIndexOutOfBoundsException - -<a name="v_A06"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M1 - August 3, 2009 - 3.6M1 -<br>Project org.eclipse.jdt.core v_A06 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A06">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284948">284948</a> -[1.6][compiler] Java annotations are broken in editor when used on interface methods - -<a name="v_A05"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M1 - July 30, 2009 -<br>Project org.eclipse.jdt.core v_A05 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A05">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276526">276526</a> -[content assist] Error - Type Duplicate interface Iterable for the type TestClass -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=191176">191176</a> -JavaProject#getOption optimizations - -<a name="v_A04"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M1 - July 28, 2009 -<br>Project org.eclipse.jdt.core v_A04 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A04">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261909">261909</a> -ClassFileReader.getModifiers() answers funny bits -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283225">283225</a> -[1.6][compiler] classfile versus source conformance check too strict -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284679">284679</a> -[formatter] empty single semi statement prevent enum elements format -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284482">284482</a> -[compiler] Collision cases not detected -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284431">284431</a> -Different inherited thrown exception clauses are not properly handled -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=133911">133911</a> -type.move() returns unclear exception "invalid destination" -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270436">270436</a> -[assist] Interface type proposed where only class is legal -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=210385">210385</a> -[compiler] ProblemReporter#getProblemCategory misbehaves when passed ProblemSeverities.Ignore as severity parameter -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282891">282891</a> -[compiler] "Comparing identical expressions" warning sometimes invalid -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282869">282869</a> -[compiler] Unnecessary cast warning for cast from char to int -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270437">270437</a> -[assist] Completion proposal leads to cycle detected error -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=217443">217443</a> -Documentation for JavaCore#CORE_ENCODING does not match the observed behavior - -<a name="v_A03"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M1 - July 21, 2009 -<br>Project org.eclipse.jdt.core v_A03 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A03">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283467">283467</a> -[formatter] wrong indentation with 'Never join lines' selected -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281776">281776</a> -Should not warn for comparison of identical expression with float type -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282768">282768</a> -[compiler] Dead code detection should ignore trivial case for ternary if operator -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283133">283133</a> -[formatter] IAE when pasting a snippet -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283299">283299</a> -Complete SourceRange API - -<a name="v_A02"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java Development Tooling Core</h1> -Eclipse SDK 3.6M1 - July 13, 2009 -<br>Project org.eclipse.jdt.core v_A02 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A02">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>Added new API type org.eclipse.jdt.core.SourceRange</li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=271296">271296</a> -[assist] void typed proposal may not be appropriate in many contexts -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281871">281871</a> -[content assist] The extension took too long to return from the 'computeCompletionProposals()' operation -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281598">281598</a> -[assist] Problems during content assist - if project has empty zip file in classpath -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235294">235294</a> -[formatter] javadoc for DefaultCodeFormatterConstants#FORMATTER_ALIGNMENT_FOR_ASSIGNMENT cites a non-API constant -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280497">280497</a> -Incorrect null result for IJavaProject.getClasspathEntryFor(IPath) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=204777">204777</a> -Clarify documentation for ITypeHierarchy created on interface types -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=88265">88265</a> -Make SourceRange API - -<a name="v_A01"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M1 - July 7, 2009 -<br>Project org.eclipse.jdt.core v_A01 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A01">cvs</a>). -<h2>What's new in this drop</h2> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=260968">260968</a> -Deadlock in UserLibraryManager - -<a name="v_A00"></a> -<hr><h1> -Eclipse Platform Build Notes<br> -Java development tools core</h1> -Eclipse SDK 3.6M1 - June 30, 2009 -<br>Project org.eclipse.jdt.core v_A00 -(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A00">cvs</a>). -<h2>What's new in this drop</h2> -<ul> -<li>New API added to handle the new <code>invokedynamic</code> bytecode: -<pre> -org.eclipse.jdt.core.util.ByteCodeVisitorAdapter: - public void _invokedynamic( - int pc, - int index, - IConstantPoolEntry nameEntry, - IConstantPoolEntry descriptorEntry) { - // default behavior is to do nothing - } -</pre> -<pre>org.eclipse.jdt.core.util.IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry, IConstantPoolEntry)</pre> -<pre>org.eclipse.jdt.core.util.IOpcodeMnemonics#INVOKEDYNAMIC</pre> -</li> -</ul> - -<h3>Problem Reports Fixed</h3> -<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277450">277450</a> -[1.5][compiler] Problems with += and Autoboxing/Unboxing -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=206498">206498</a> -[1.7][compiler] Remove fix for bug 206483 once 1.7 VMS can handle .class files with version 51.0 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=191176">191176</a> -JavaProject#getOption optimizations -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=201762">201762</a> -Content Assist has no proposals with certain CU structure -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281681">281681</a> -Stale code in CompilerOptions -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=231796">231796</a> -[formatter] @throws tag description is not indented using @param preference when there's a syntax error -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=255142">255142</a> -[select] Codeselect should not omit cast -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235295">235295</a> -[formatter] javadoc of CodeFormatter#F_INCLUDE_COMMENTS needs improvement -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280134">280134</a> -[1.5][compiler] Requesting Java AST from selection has encountered a problem -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281317">281317</a> -[search] An internal error occurred during: "Java Search". -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276373">276373</a> -Incorrect resource comparison with IJavaProject.isOnClasspath(IResource) -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=275518">275518</a> -[assist] Content assist does not provide proposals if invoked right after a method's opening brace -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280888">280888</a> -change a java file in one plug-in will compile all related plugin projects -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=274466">274466</a> -[assist] Assert expressions should be proposed with high relevance -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277382">277382</a> -NPE and other failures in Parser -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=275330">275330</a> -NPE from org.eclipse.jdt.internal.core.ClasspathChange.requestIndexing -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=273385">273385</a> -[model] NPE while closing project -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280079">280079</a> -NPE while parsing K_CLASS_BODY_DECLARATIONS -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280063">280063</a> -org.eclipse.jdt.internal.compiler.parser.Parser.parseClassBodyDeclarations(char[], int, int, CompilationUnitDeclaration) should return consistent results -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267046">267046</a> -SourceMapper infinite loop on primitive type in generic -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=240934">240934</a> -Add support for the invokedynamic bytecode into the disassembler -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267551">267551</a> -[formatter] Wrong spacing in default array parameter for annotation type -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277965">277965</a> -[compiler] NPE in canBeSeenBy due to illegal protected toplevel class -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=273990">273990</a> -[compiler] FUP of 269388: Eclipse accepts code rejected by javac -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=279183">279183</a> -[1.6][compiler] Inconsistent stackmap frames generated by JDT cause VerifyError -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=209778">209778</a> -[search] TypeReferenceMatch#getOtherElements() fails for match in annotation -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=221065">221065</a> -[search] Search still finds overridden method -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836">279836</a> -[1.5][compiler] Eclipse compiler shows error on javac-valid construct: raw types on overridden methods -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280616">280616</a> -[formatter] Valid 1.5 code is not formatted inside <pre> tag -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280255">280255</a> -[formatter] Format edited lines adds two new lines on each save -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280061">280061</a> -[formatter] AIOOBE while formatting javadoc comment -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276938">276938</a> -Remove unreachable removes reachable logic in case statement. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=274898">274898</a> -[recovery] IllegalArgumentException in ASTNode#setSourceRange() -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277204">277204</a> -IAE in SharedASTProvider for generic local class. -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276741">276741</a> -comparing identical value detection does not work for this -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276740">276740</a> -comparing identical value detection does not work for primitive types -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=278745">278745</a> -Methods overloaded with unavailable types worked in 3.4 but give "indirectly referenced.." error in 3.5 -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=278305">278305</a> -[1.5][compiler] JDT accepts supertype parameterized with wildcard -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=196308">196308</a> -[formatter] Don't escape entity when formatting in <pre> tags within javadoc comments -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=279359">279359</a> -[formatter] Formatter with 'never join lines' produces extra level of indent -<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=273619">273619</a> -[formatter] Formatting repeats *} in javadoc <hr> -<p>For earlier build notes, also see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R35_buildnotes_jdt-core.html">build notes up to Release 3.5</a>.</p> +<p>For earlier build notes, also see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R36_buildnotes_jdt-core.html">build notes up to Release 3.6</a>.</p> <br> <p> <a href="http://validator.w3.org/check?uri=referer"><img diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java index 015ff5ece..8e413de91 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java @@ -73,6 +73,7 @@ import org.eclipse.jdt.internal.core.BinaryTypeConverter; import org.eclipse.jdt.internal.core.SearchableEnvironment; import org.eclipse.jdt.internal.core.SourceTypeElementInfo; import org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment; +import org.eclipse.jdt.internal.core.search.matching.MatchLocator; import org.eclipse.jdt.internal.core.util.Messages; import org.eclipse.objectteams.otdt.core.IOTType; import org.eclipse.objectteams.otdt.core.OTModelManager; @@ -530,6 +531,8 @@ public final class CompletionEngine private final static int SUPERTYPE = 1; private final static int SUBTYPE = 2; + private final static char[] DOT_ENUM = ".enum".toCharArray(); //$NON-NLS-1$ + int expectedTypesPtr = -1; TypeBinding[] expectedTypes = new TypeBinding[1]; int expectedTypesFilter; @@ -552,8 +555,10 @@ public final class CompletionEngine boolean assistNodeIsConstructor; boolean assistNodeIsSuperType; boolean assistNodeIsExtendedType; + boolean assistNodeIsInterfaceExcludingAnnotation; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310423 int assistNodeInJavadoc = 0; boolean assistNodeCanBeSingleMemberAnnotation = false; + boolean assistNodeIsInsideCase = false; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346 long targetedElement; //{ObjectTeams: @@ -650,6 +655,7 @@ public final class CompletionEngine public void setFieldIndex(int depth){/* empty */} public int sourceEnd() { return 0; } public int sourceStart() { return 0; } + public TypeBinding expectedType() { return null; } }; private int foundTypesCount; @@ -2896,6 +2902,7 @@ public final class CompletionEngine this.assistNodeIsInterface = ref.isInterface(); this.assistNodeIsSuperType = ref.isSuperType(); this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); + this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent); this.completionToken = ref.completionIdentifier; long completionPosition = ref.sourcePositions[ref.tokens.length]; @@ -2958,6 +2965,37 @@ public final class CompletionEngine return false; } + private boolean assistNodeIsInterfaceExcludingAnnotation(ASTNode astNode, ASTNode astNodeParent) { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310423, don't propose annotations for implements. + if (astNodeParent == null) + return false; + if (astNodeParent instanceof TypeDeclaration) { + TypeDeclaration typeDeclaration = (TypeDeclaration) astNodeParent; + TypeReference [] superInterfaces = typeDeclaration.superInterfaces; + int length = superInterfaces == null ? 0 : superInterfaces.length; + for (int i = 0; i < length; i++) { + if (superInterfaces[i] == astNode) + return true; + } + } + return false; + } + + private boolean assistNodeIsInsideCase(ASTNode astNode, ASTNode astNodeParent) { + // To find whether we're completing inside the case expression in a + // switch case construct (https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346) + if (astNodeParent instanceof SwitchStatement) { + CaseStatement[] cases = ((SwitchStatement) astNodeParent).cases; + for (int i = 0, caseCount = ((SwitchStatement) astNodeParent).caseCount; i < caseCount; i++) { + CompletionNodeDetector detector = new CompletionNodeDetector(astNode, cases[i]); + if (detector.containsCompletionNode()) { + return true; + } + } + } + return false; + } + private void completionOnQualifiedAllocationExpression(ASTNode astNode, Binding qualifiedBinding, Scope scope) { setSourceAndTokenRange(astNode.sourceStart, astNode.sourceEnd, false); @@ -3014,6 +3052,7 @@ public final class CompletionEngine (CompletionOnQualifiedNameReference) astNode; this.completionToken = ref.completionIdentifier; long completionPosition = ref.sourcePositions[ref.sourcePositions.length - 1]; + this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, this.parser.assistNodeParent); if (qualifiedBinding.problemId() == ProblemReasons.NotFound) { setSourceAndTokenRange((int) (completionPosition >>> 32), (int) completionPosition); @@ -3157,7 +3196,9 @@ public final class CompletionEngine this.assistNodeIsConstructor = ref.isConstructorType; this.assistNodeIsSuperType = ref.isSuperType(); this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); - + this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent); + this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, astNodeParent); + this.completionToken = ref.completionIdentifier; long completionPosition = ref.sourcePositions[ref.tokens.length]; @@ -3217,6 +3258,7 @@ public final class CompletionEngine CompletionOnSingleNameReference singleNameReference = (CompletionOnSingleNameReference) astNode; this.completionToken = singleNameReference.token; SwitchStatement switchStatement = astNodeParent instanceof SwitchStatement ? (SwitchStatement) astNodeParent : null; + this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, astNodeParent); if (switchStatement != null && switchStatement.expression.resolvedType != null && switchStatement.expression.resolvedType.isEnum()) { @@ -3298,7 +3340,9 @@ public final class CompletionEngine this.assistNodeIsConstructor = singleRef.isConstructorType; this.assistNodeIsSuperType = singleRef.isSuperType(); this.assistNodeIsExtendedType = assistNodeIsExtendedType(astNode, astNodeParent); - + this.assistNodeIsInterfaceExcludingAnnotation = assistNodeIsInterfaceExcludingAnnotation(astNode, astNodeParent); + this.assistNodeIsInsideCase = assistNodeIsInsideCase(astNode, astNodeParent); + // can be the start of a qualified type name if (qualifiedBinding == null) { if (this.completionToken.length == 0 && @@ -4233,6 +4277,13 @@ public final class CompletionEngine } return 0; } + + private int computeRelevanceForFinal(boolean onlyFinal, boolean isFinal) { + if (onlyFinal && isFinal) { + return R_FINAL; + } + return 0; + } private long computeTargetedElement(CompletionOnAnnotationOfType fakeNode) { ASTNode annotatedElement = fakeNode.potentialAnnotatedNode; @@ -6178,6 +6229,20 @@ public final class CompletionEngine // SH} if (this.options.checkVisibility && !field.canBeSeenBy(receiverType, invocationSite, scope)) continue next; + + // don't propose array types in case expression + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346 + if (this.assistNodeIsInsideCase && field.type instanceof ArrayBinding) + continue next; + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=310427 + // Don't propose field which is being declared currently + // Don't propose fields declared after the current field declaration statement + if (this.parser.assistNodeParent instanceof FieldDeclaration) { + FieldDeclaration fieldDeclaration = (FieldDeclaration) this.parser.assistNodeParent; + if (field.id >= fieldDeclaration.binding.id) + continue next; + } //{ObjectTeams: additional check if method spec type already known: if (expectedType != null && expectedType != field.type) continue next; @@ -6291,6 +6356,7 @@ public final class CompletionEngine relevance += computeRelevanceForExpectingType(field.type); relevance += computeRelevanceForEnumConstant(field.type); relevance += computeRelevanceForStatic(onlyStaticFields, field.isStatic()); + relevance += computeRelevanceForFinal(this.assistNodeIsInsideCase, field.isFinal()); relevance += computeRelevanceForQualification(prefixRequired); relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); if (onlyStaticFields && this.insideQualifiedReference) { @@ -7005,133 +7071,142 @@ public final class CompletionEngine if (enclosingNode == null || !(enclosingNode instanceof IfStatement)) return; IfStatement ifStatement = (IfStatement)enclosingNode; - - if (!(ifStatement.condition instanceof InstanceOfExpression)) return; - - InstanceOfExpression instanceOfExpression = (InstanceOfExpression) ifStatement.condition; - - TypeReference instanceOfType = instanceOfExpression.type; - - if (instanceOfType.resolvedType == null) return; - - boolean findFromAnotherReceiver = false; - - char[][] receiverName = null; - int receiverStart = -1; - int receiverEnd = -1; - - if (receiver instanceof QualifiedNameReference) { - QualifiedNameReference qualifiedNameReference = (QualifiedNameReference) receiver; - - receiverName = qualifiedNameReference.tokens; - - if (receiverName.length != 1) return; - - receiverStart = (int) (qualifiedNameReference.sourcePositions[0] >>> 32); - receiverEnd = (int) qualifiedNameReference.sourcePositions[qualifiedNameReference.tokens.length - 1] + 1; - - // if (local instanceof X) local.| - // if (field instanceof X) field.| - if (instanceOfExpression.expression instanceof SingleNameReference && - ((SingleNameReference)instanceOfExpression.expression).binding == qualifiedBinding && - (qualifiedBinding instanceof LocalVariableBinding || qualifiedBinding instanceof FieldBinding)) { - findFromAnotherReceiver = true; - } - - // if (this.field instanceof X) field.| - if (instanceOfExpression.expression instanceof FieldReference) { - FieldReference fieldReference = (FieldReference)instanceOfExpression.expression; - - if (fieldReference.receiver instanceof ThisReference && - qualifiedBinding instanceof FieldBinding && - fieldReference.binding == qualifiedBinding) { - findFromAnotherReceiver = true; - } - } - } else if (receiver instanceof FieldReference) { - FieldReference fieldReference1 = (FieldReference) receiver; - - receiverStart = fieldReference1.sourceStart; - receiverEnd = fieldReference1.sourceEnd + 1; - - if (fieldReference1.receiver instanceof ThisReference) { - - receiverName = new char[][] {THIS, fieldReference1.token}; - - // if (field instanceof X) this.field.| + while (true) { + if (!(ifStatement.condition instanceof InstanceOfExpression)) return; + + InstanceOfExpression instanceOfExpression = (InstanceOfExpression) ifStatement.condition; + + TypeReference instanceOfType = instanceOfExpression.type; + + if (instanceOfType.resolvedType == null) return; + + boolean findFromAnotherReceiver = false; + + char[][] receiverName = null; + int receiverStart = -1; + int receiverEnd = -1; + + if (receiver instanceof QualifiedNameReference) { + QualifiedNameReference qualifiedNameReference = (QualifiedNameReference) receiver; + + receiverName = qualifiedNameReference.tokens; + + if (receiverName.length != 1) return; + + receiverStart = (int) (qualifiedNameReference.sourcePositions[0] >>> 32); + receiverEnd = (int) qualifiedNameReference.sourcePositions[qualifiedNameReference.tokens.length - 1] + 1; + + // if (local instanceof X) local.| + // if (field instanceof X) field.| if (instanceOfExpression.expression instanceof SingleNameReference && - ((SingleNameReference)instanceOfExpression.expression).binding == fieldReference1.binding) { + ((SingleNameReference)instanceOfExpression.expression).binding == qualifiedBinding && + (qualifiedBinding instanceof LocalVariableBinding || qualifiedBinding instanceof FieldBinding)) { findFromAnotherReceiver = true; } - - // if (this.field instanceof X) this.field.| + + // if (this.field instanceof X) field.| if (instanceOfExpression.expression instanceof FieldReference) { - FieldReference fieldReference2 = (FieldReference)instanceOfExpression.expression; - - if (fieldReference2.receiver instanceof ThisReference && - fieldReference2.binding == fieldReference1.binding) { + FieldReference fieldReference = (FieldReference)instanceOfExpression.expression; + + if (fieldReference.receiver instanceof ThisReference && + qualifiedBinding instanceof FieldBinding && + fieldReference.binding == qualifiedBinding) { findFromAnotherReceiver = true; } } + } else if (receiver instanceof FieldReference) { + FieldReference fieldReference1 = (FieldReference) receiver; + + receiverStart = fieldReference1.sourceStart; + receiverEnd = fieldReference1.sourceEnd + 1; + + if (fieldReference1.receiver instanceof ThisReference) { + + receiverName = new char[][] {THIS, fieldReference1.token}; + + // if (field instanceof X) this.field.| + if (instanceOfExpression.expression instanceof SingleNameReference && + ((SingleNameReference)instanceOfExpression.expression).binding == fieldReference1.binding) { + findFromAnotherReceiver = true; + } + + // if (this.field instanceof X) this.field.| + if (instanceOfExpression.expression instanceof FieldReference) { + FieldReference fieldReference2 = (FieldReference)instanceOfExpression.expression; + + if (fieldReference2.receiver instanceof ThisReference && + fieldReference2.binding == fieldReference1.binding) { + findFromAnotherReceiver = true; + } + } + } } - } - - if (findFromAnotherReceiver) { - TypeBinding receiverTypeBinding = instanceOfType.resolvedType; - char[] castedReceiver = null; - - char[] castedTypeChars = CharOperation.concatWith(instanceOfType.getTypeName(), '.'); - if(this.source != null) { - int memberRefStart = this.startPosition; - - char[] receiverChars = CharOperation.subarray(this.source, receiverStart, receiverEnd); - char[] dotChars = CharOperation.subarray(this.source, receiverEnd, memberRefStart); - - castedReceiver = - CharOperation.concat( + + if (findFromAnotherReceiver) { + TypeBinding receiverTypeBinding = instanceOfType.resolvedType; + char[] castedReceiver = null; + + char[] castedTypeChars = CharOperation.concatWith(instanceOfType.getTypeName(), '.'); + if(this.source != null) { + int memberRefStart = this.startPosition; + + char[] receiverChars = CharOperation.subarray(this.source, receiverStart, receiverEnd); + char[] dotChars = CharOperation.subarray(this.source, receiverEnd, memberRefStart); + + castedReceiver = CharOperation.concat( - '(', CharOperation.concat( - CharOperation.concat('(', castedTypeChars, ')'), - receiverChars), - ')'), - dotChars); - } else { - castedReceiver = - CharOperation.concat( + '(', + CharOperation.concat( + CharOperation.concat('(', castedTypeChars, ')'), + receiverChars), + ')'), + dotChars); + } else { + castedReceiver = CharOperation.concat( - '(', CharOperation.concat( - CharOperation.concat('(', castedTypeChars, ')'), - CharOperation.concatWith(receiverName, '.')), - ')'), - DOT); + '(', + CharOperation.concat( + CharOperation.concat('(', castedTypeChars, ')'), + CharOperation.concatWith(receiverName, '.')), + ')'), + DOT); + } + + if (castedReceiver == null) return; + + int oldStartPosition = this.startPosition; + this.startPosition = receiverStart; + + findFieldsAndMethods( + this.completionToken, + receiverTypeBinding, + scope, + fieldsFound, + methodsFound, + invocationSite, + invocationScope, + false, + false, + null, + null, + null, + false, + castedReceiver, + receiverStart, + receiverEnd); + + this.startPosition = oldStartPosition; + } + // traverse the enclosing node to find the instanceof expression corresponding + // to the completion node (if any) + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=304006 + if (ifStatement.thenStatement instanceof IfStatement) { + ifStatement = (IfStatement) ifStatement.thenStatement; + } else { + break; } - - if (castedReceiver == null) return; - - int oldStartPosition = this.startPosition; - this.startPosition = receiverStart; - - findFieldsAndMethods( - this.completionToken, - receiverTypeBinding, - scope, - fieldsFound, - methodsFound, - invocationSite, - invocationScope, - false, - false, - null, - null, - null, - false, - castedReceiver, - receiverStart, - receiverEnd); - - this.startPosition = oldStartPosition; } } private void findFieldsAndMethodsFromFavorites( @@ -9811,6 +9886,7 @@ public final class CompletionEngine typesFound.add(memberType); if (this.assistNodeIsExtendedType && memberType.isFinal()) continue next; + if (this.assistNodeIsInterfaceExcludingAnnotation && memberType.isAnnotationType()) continue next; if(!this.insideQualifiedReference) { if(this.assistNodeIsClass) { //{ObjectTeams: different determination of class/interface for roles: @@ -10409,6 +10485,7 @@ public final class CompletionEngine } if (this.assistNodeIsExtendedType && localType.isFinal()) continue next; + if (this.assistNodeIsInterfaceExcludingAnnotation && localType.isAnnotationType()) continue next; if(this.assistNodeIsClass) { if(!localType.isClass()) continue next; } else if(this.assistNodeIsInterface) { @@ -10903,6 +10980,7 @@ public final class CompletionEngine typesFound.add(sourceType); if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue next; + if (this.assistNodeIsInterfaceExcludingAnnotation && sourceType.isAnnotationType()) continue next; if(this.assistNodeIsClass) { if(!sourceType.isClass()) continue next; } else if(this.assistNodeIsInterface) { @@ -11036,6 +11114,8 @@ public final class CompletionEngine int searchFor = IJavaSearchConstants.TYPE; if(this.assistNodeIsClass) { searchFor = IJavaSearchConstants.CLASS; + } else if (this.assistNodeIsInterfaceExcludingAnnotation) { + searchFor = IJavaSearchConstants.INTERFACE; } else if(this.assistNodeIsInterface) { searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; } else if(this.assistNodeIsEnum) { @@ -11128,6 +11208,7 @@ public final class CompletionEngine continue; if (this.assistNodeIsExtendedType && sourceType.isFinal()) continue; + if (this.assistNodeIsInterfaceExcludingAnnotation && sourceType.isAnnotationType()) continue; int accessibility = IAccessRule.K_ACCESSIBLE; if(sourceType.hasRestrictedAccess()) { AccessRestriction accessRestriction = this.lookupEnvironment.getAccessRestriction(sourceType); @@ -11215,6 +11296,8 @@ public final class CompletionEngine int searchFor = IJavaSearchConstants.TYPE; if(this.assistNodeIsClass) { searchFor = IJavaSearchConstants.CLASS; + } else if (this.assistNodeIsInterfaceExcludingAnnotation) { + searchFor = IJavaSearchConstants.INTERFACE; } else if(this.assistNodeIsInterface) { searchFor = IJavaSearchConstants.INTERFACE_AND_ANNOTATION; } else if(this.assistNodeIsEnum) { @@ -11321,6 +11404,7 @@ public final class CompletionEngine } if (this.assistNodeIsExtendedType && refBinding.isFinal()) continue next; + if (this.assistNodeIsInterfaceExcludingAnnotation && refBinding.isAnnotationType()) continue next; if(this.assistNodeIsClass) { if(!refBinding.isClass()) continue next; } else if(this.assistNodeIsInterface) { @@ -11451,6 +11535,7 @@ public final class CompletionEngine typesFound.add(typeBinding); if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; + if (this.assistNodeIsInterfaceExcludingAnnotation && typeBinding.isAnnotationType()) continue; if(this.assistNodeIsClass) { if(!typeBinding.isClass()) continue; } else if(this.assistNodeIsInterface) { @@ -11554,6 +11639,7 @@ public final class CompletionEngine typesFound.add(typeBinding); if (this.assistNodeIsExtendedType && typeBinding.isFinal()) continue; + if (this.assistNodeIsInterfaceExcludingAnnotation && typeBinding.isAnnotationType()) continue; if(this.assistNodeIsClass) { if(!typeBinding.isClass()) continue; } else if(this.assistNodeIsInterface) { @@ -12077,6 +12163,21 @@ public final class CompletionEngine // carp} if (local.isSecret()) continue next; + + // don't propose array types in case expression + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346 + if (this.assistNodeIsInsideCase && local.type instanceof ArrayBinding) + continue next; + + int ptr = this.uninterestingBindingsPtr; + // Cases where the binding is uninteresting eg. for completion occurring inside a local var + // declaration, the local var binding is uninteresting and shouldn't be proposed. + while (ptr >= 0) { + if (this.uninterestingBindings[ptr] == local) { + continue next; + } + ptr--; + } for (int f = 0; f < localsFound.size; f++) { LocalVariableBinding otherLocal = @@ -12094,6 +12195,7 @@ public final class CompletionEngine relevance += computeRelevanceForEnumConstant(local.type); relevance += computeRelevanceForQualification(false); relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for local variable + relevance += computeRelevanceForFinal(this.assistNodeIsInsideCase, local.isFinal()); this.noProposal = false; if(!this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) { InternalCompletionProposal proposal = createProposal(CompletionProposal.LOCAL_VARIABLE_REF, this.actualCompletionPosition); @@ -12486,6 +12588,14 @@ public final class CompletionEngine } } } + + // filter packages ending with enum for projects above 1.5 + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264 + if (MatchLocator.SHOULD_FILTER_ENUM && this.compilerOptions.sourceLevel >= ClassFileConstants.JDK1_5 && + CharOperation.endsWith(givenPkgName, DOT_ENUM)) { //note: it should be .enum and not just enum + return true; + } + return false; } @@ -13391,18 +13501,7 @@ public final class CompletionEngine // treating MethodSpec(long) like a call, we need a fake InvocationSite: InvocationSite site = null; if (methodSpec.hasSignature) - site = new InvocationSite() { - public TypeBinding[] genericTypeArguments() { return null; } - public boolean isSuperAccess() { return false; } - public boolean isTypeAccess() { return false; } - public void setActualReceiverType(ReferenceBinding receiverType) {} - public void setDepth(int depth) { - // TODO Auto-generated method stub - } - public void setFieldIndex(int depth) {} - public int sourceEnd() { return end; } - public int sourceStart() { return start; } - }; + site = FakeInvocationSite; try { this.currentMethodMapping = mapping; findMethods( @@ -13523,18 +13622,7 @@ public final class CompletionEngine // treating FieldAccessSpec(long) like a field access, we need a fake InvocationSite: InvocationSite site = null; if (hasSignature) - site = new InvocationSite() { - public TypeBinding[] genericTypeArguments() { return null; } - public boolean isSuperAccess() { return false; } - public boolean isTypeAccess() { return false; } - public void setActualReceiverType(ReferenceBinding receiverType) {} - public void setDepth(int depth) { - // TODO Auto-generated method stub - } - public void setFieldIndex(int depth) {} - public int sourceEnd() { return end; } - public int sourceStart() { return start; } - }; + site = FakeInvocationSite; ObjectVector fieldsFound = new ObjectVector(); findFields( this.completionToken, diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java index 3a09a4829..7b4e0e89a 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Andreas Magnusson <andreas.ch.magnusson@gmail.com>- contribution for bug 151500 * Technical University Berlin - extended API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.codeassist; @@ -195,7 +196,8 @@ public class InternalCompletionProposal extends CompletionProposal { } } else { // TODO (david) shouldn't it be NameLookup.ACCEPT_ALL ? - NameLookup.Answer answer = this.nameLookup.findType(new String(tName), + NameLookup.Answer answer = this.nameLookup.findType(new String(declaringTypeName), + new String(declaringTypePackageName), false, NameLookup.ACCEPT_CLASSES & NameLookup.ACCEPT_INTERFACES, true/* consider secondary types */, @@ -211,21 +213,20 @@ public class InternalCompletionProposal extends CompletionProposal { } if(type != null) { - String[] args = new String[length]; - for(int i = 0; i< length ; i++){ - args[i] = new String(paramTypeNames[i]); - } - IMethod method = type.getMethod(new String(selector),args); - - if (this.hasNoParameterNamesFromIndex) { - IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot)type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); - if (packageFragmentRoot.isArchive() || - this.completionEngine.openedBinaryTypes < getOpenedBinaryTypesThreshold()) { - SourceMapper mapper = ((JavaElement)method).getSourceMapper(); - if (mapper != null) { - try { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 + // BinaryType#getMethod() creates a new instance of BinaryMethod, which is a dummy. + // Instead we have to use IType#findMethods() to get a handle to the method of our interest. + try { + IMethod method = findMethod(type, selector, paramTypeNames); + if (this.hasNoParameterNamesFromIndex) { + + IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot)type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); + if (packageFragmentRoot.isArchive() || + this.completionEngine.openedBinaryTypes < getOpenedBinaryTypesThreshold()) { + SourceMapper mapper = ((JavaElement)method).getSourceMapper(); + if (mapper != null) { char[][] paramNames = mapper.getMethodParameterNames(method); - + // map source and try to find parameter names if(paramNames == null) { if (!packageFragmentRoot.isArchive()) this.completionEngine.openedBinaryTypes++; @@ -236,35 +237,28 @@ public class InternalCompletionProposal extends CompletionProposal { } paramNames = mapper.getMethodParameterNames(method); } - + if(paramNames != null) { parameters = paramNames; } - } catch(JavaModelException e){ - //parameters == null; } } - } - } else { - try{ + } else { IBinaryMethod info = (IBinaryMethod) ((JavaElement)method).getElementInfo(); char[][] argumentNames = info.getArgumentNames(); if (argumentNames != null && argumentNames.length == length) { parameters = argumentNames; + return parameters; } - } catch(JavaModelException e){ - //parameters == null; - } - - try{ + parameters = new char[length][]; String[] params = method.getParameterNames(); for(int i = 0; i< length ; i++){ parameters[i] = params[i].toCharArray(); } - } catch(JavaModelException e){ - parameters = null; } + } catch(JavaModelException e){ + parameters = null; } } @@ -292,7 +286,8 @@ public class InternalCompletionProposal extends CompletionProposal { } } else { // TODO (david) shouldn't it be NameLookup.ACCEPT_ALL ? - NameLookup.Answer answer = this.nameLookup.findType(new String(tName), + NameLookup.Answer answer = this.nameLookup.findType(new String(declaringTypeName), + new String(declaringTypePackageName), false, NameLookup.ACCEPT_CLASSES & NameLookup.ACCEPT_INTERFACES, true/* consider secondary types */, @@ -308,12 +303,11 @@ public class InternalCompletionProposal extends CompletionProposal { } if(type != null) { - String[] args = new String[length]; - for(int i = 0; i< length ; i++){ - args[i] = new String(paramTypeNames[i]); - } - IMethod method = type.getMethod(new String(selector),args); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 + // BinaryType#getMethod() creates a new instance of BinaryMethod, which is a dummy. + // Instead we have to use IType#findMethods() to get a handle to the method of our interest. try{ + IMethod method = findMethod(type, selector, paramTypeNames); parameters = new char[length][]; String[] params = method.getParameterNames(); for(int i = 0; i< length ; i++){ @@ -332,6 +326,35 @@ public class InternalCompletionProposal extends CompletionProposal { return parameters; } + private IMethod findMethod(IType type, char[] selector, char[][] paramTypeNames) throws JavaModelException { + IMethod method = null; + int startingIndex = 0; + String[] args; + IType enclosingType = type.getDeclaringType(); + // If the method is a constructor of a non-static inner type, add the enclosing type as an + // additional parameter to the constructor + if (enclosingType != null + && CharOperation.equals(type.getElementName().toCharArray(), selector) + && !Flags.isStatic(type.getFlags())) { + args = new String[paramTypeNames.length+1]; + startingIndex = 1; + args[0] = Signature.createTypeSignature(enclosingType.getFullyQualifiedName(), true); + } else { + args = new String[paramTypeNames.length]; + } + int length = args.length; + for(int i = startingIndex; i< length ; i++){ + args[i] = new String(paramTypeNames[i-startingIndex]); + } + method = type.getMethod(new String(selector), args); + + IMethod[] methods = type.findMethods(method); + if (methods != null && methods.length > 0) { + method = methods[0]; + } + return method; + } + protected char[] getDeclarationPackageName() { return this.declarationPackageName; } diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java index 4b85ad5c5..de5ec24fd 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java @@ -20,11 +20,11 @@ import org.eclipse.jdt.core.ITypeRoot; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.WorkingCopyOwner; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.codeassist.complete.CompletionNodeDetector; import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; import org.eclipse.jdt.internal.codeassist.impl.AssistCompilationUnit; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.Initializer; @@ -190,13 +190,39 @@ public class InternalExtendedCompletionContext { } } else { FieldDeclaration fieldDeclaration = fields[i]; - if (fieldDeclaration.initialization != null && - fieldDeclaration.initialization.sourceStart <= astNode.sourceStart && - astNode.sourceEnd <= fieldDeclaration.initialization.sourceEnd) { + if (fieldDeclaration.initialization != null) { // completion is inside a field initializer searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc); + // remove this field from visibleFields list because completion is being asked in its + // intialization and so this has not yet been declared successfully. + if (this.visibleFields.size > 0 && this.visibleFields.contains(fieldDeclaration.binding)) { + this.visibleFields.remove(fieldDeclaration.binding); + } break done; } + /*(Incase fieldDeclaration != null is not sufficient to infer that + proposal is being asked inside initializer of field decl, use the below if + block instead of the above) + if (fieldDeclaration.initialization != null) { + + if (fieldDeclaration.initialization.sourceEnd > 0) { + if (fieldDeclaration.initialization.sourceStart <= astNode.sourceStart && + astNode.sourceEnd <= fieldDeclaration.initialization.sourceEnd) { + // completion is inside a field initializer + searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc); + } + } else { // The sourceEnd may not yet be set + CompletionNodeDetector detector = new CompletionNodeDetector(this.assistNode, fieldDeclaration.initialization); + if (detector.containsCompletionNode()) { + searchVisibleVariablesAndMethods(scope, this.visibleLocalVariables, this.visibleFields, this.visibleMethods, notInJavadoc); + } + } + // remove this field from visibleFields list because completion is being asked in its + // intialization and so this has not yet been declared successfully. + if (this.visibleFields.size > 0 && this.visibleFields.contains(fieldDeclaration.binding)) { + this.visibleFields.remove(fieldDeclaration.binding); + } + }*/ } } } @@ -245,7 +271,9 @@ public class InternalExtendedCompletionContext { local.sourceStart, local.sourceEnd, Util.typeSignature(local.type), - binding.declaration.annotations); + binding.declaration.annotations, + local.modifiers, + local.getKind() == AbstractVariableDeclaration.PARAMETER); } private JavaElement getJavaElementOfCompilationUnit(Binding binding) { @@ -736,11 +764,13 @@ public class InternalExtendedCompletionContext { // If the local variable declaration's initialization statement itself has the completion, // then don't propose the local variable if (local.declaration.initialization != null) { - if(local.declaration.initialization.sourceEnd > 0) { - if (this.assistNode.sourceEnd <= local.declaration.initialization.sourceEnd - && this.assistNode.sourceStart >= local.declaration.initialization.sourceStart) { - continue next; - } + /*(use this if-else block if it is found that local.declaration.initialization != null is not sufficient to + guarantee that proposal is being asked inside a local variable declaration's initializer) + if(local.declaration.initialization.sourceEnd > 0) { + if (this.assistNode.sourceEnd <= local.declaration.initialization.sourceEnd + && this.assistNode.sourceStart >= local.declaration.initialization.sourceStart) { + continue next; + } } else { CompletionNodeDetector detector = new CompletionNodeDetector( this.assistNode, @@ -748,7 +778,8 @@ public class InternalExtendedCompletionContext { if (detector.containsCompletionNode()) { continue next; } - } + }*/ + continue next; } for (int f = 0; f < localsFound.size; f++) { LocalVariableBinding otherLocal = diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java index 72abf4f93..3b17e51de 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java @@ -53,4 +53,5 @@ public interface RelevanceConstants { int R_NO_PROBLEMS = 1; int R_RESOLVED = 1; int R_TARGET = 5; + int R_FINAL = 3; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=195346 } diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java index 5284162f8..fe6d94119 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -41,10 +41,10 @@ public class CompletionOnPackageReference extends ImportReference { //{ObjectTeams: modifiers added: /*orig: public CompletionOnPackageReference(char[][] tokens , long[] positions) { - super(tokens, positions, true, ClassFileConstants.AccDefault); + super(tokens, positions, false, ClassFileConstants.AccDefault); :giro*/ public CompletionOnPackageReference(char[][] tokens , long[] positions, int modifiers) { - super(tokens, positions, true, modifiers); + super(tokens, positions, false, modifiers); // SH} } public StringBuffer print(int indent, StringBuffer output, boolean withOnDemand) { diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java index 9df7f93ad..968ba90b8 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java @@ -597,8 +597,9 @@ protected void attachOrphanCompletionNode(){ if(expression == this.assistNode || (expression instanceof Assignment // https://bugs.eclipse.org/bugs/show_bug.cgi?id=287939 && ((Assignment)expression).expression == this.assistNode - && ((this.expressionPtr > 0 && this.expressionStack[this.expressionPtr - 1] instanceof InstanceOfExpression) - || (this.elementPtr >= 0 && this.elementObjectInfoStack[this.elementPtr] instanceof InstanceOfExpression))) + && ((this.expressionPtr > 0 && stackHasInstanceOfExpression(this.expressionStack, this.expressionPtr - 1)) + // In case of error in compilation unit, expression stack might not have instanceof exp, so try elementObjectInfoStack + || (this.elementPtr >= 0 && stackHasInstanceOfExpression(this.elementObjectInfoStack, this.elementPtr)))) || (expression instanceof AllocationExpression && ((AllocationExpression)expression).type == this.assistNode) || (expression instanceof AND_AND_Expression @@ -1106,7 +1107,7 @@ private void buildMoreCompletionContext(Expression expression) { } } private Statement buildMoreCompletionEnclosingContext(Statement statement) { - + IfStatement ifStatement = null; int blockIndex = lastIndexOfElement(K_BLOCK_DELIMITER); int controlIndex = lastIndexOfElement(K_CONTROL_STATEMENT_DELIMITER); int index; @@ -1119,42 +1120,63 @@ private Statement buildMoreCompletionEnclosingContext(Statement statement) { int instanceOfIndex = lastIndexOfElement(K_BETWEEN_INSTANCEOF_AND_RPAREN); index = blockIndex != -1 && instanceOfIndex < blockIndex ? blockIndex : instanceOfIndex; } - if (index != -1 && this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] != null) { - Expression condition = (Expression)this.elementObjectInfoStack[index]; - - // If currentElement is a RecoveredLocalVariable then it can be contained in the if statement - if (this.currentElement instanceof RecoveredLocalVariable && - this.currentElement.parent instanceof RecoveredBlock) { - RecoveredLocalVariable recoveredLocalVariable = (RecoveredLocalVariable) this.currentElement; - if (recoveredLocalVariable.localDeclaration.initialization == null && - statement instanceof Expression && - condition.sourceStart < recoveredLocalVariable.localDeclaration.sourceStart) { - this.currentElement.add(statement, 0); - - statement = recoveredLocalVariable.updatedStatement(0, new HashSet()); - - // RecoveredLocalVariable must be removed from its parent because the IfStatement will be added instead - RecoveredBlock recoveredBlock = (RecoveredBlock) recoveredLocalVariable.parent; - recoveredBlock.statements[--recoveredBlock.statementCount] = null; - - this.currentElement = recoveredBlock; - + while (index >= 0) { + // Try to find an enclosing if statement even if one is not found immediately preceding the completion node. + if (index != -1 && this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] != null) { + Expression condition = (Expression)this.elementObjectInfoStack[index]; + + // If currentElement is a RecoveredLocalVariable then it can be contained in the if statement + if (this.currentElement instanceof RecoveredLocalVariable && + this.currentElement.parent instanceof RecoveredBlock) { + RecoveredLocalVariable recoveredLocalVariable = (RecoveredLocalVariable) this.currentElement; + if (recoveredLocalVariable.localDeclaration.initialization == null && + statement instanceof Expression && + condition.sourceStart < recoveredLocalVariable.localDeclaration.sourceStart) { + this.currentElement.add(statement, 0); + + statement = recoveredLocalVariable.updatedStatement(0, new HashSet()); + + // RecoveredLocalVariable must be removed from its parent because the IfStatement will be added instead + RecoveredBlock recoveredBlock = (RecoveredBlock) recoveredLocalVariable.parent; + recoveredBlock.statements[--recoveredBlock.statementCount] = null; + + this.currentElement = recoveredBlock; + + } } + if (statement instanceof AND_AND_Expression && this.assistNode instanceof Statement) { + statement = (Statement) this.assistNode; + } + ifStatement = + new IfStatement( + condition, + statement, + condition.sourceStart, + statement.sourceEnd); + index--; + break; } - if (statement instanceof AND_AND_Expression && this.assistNode instanceof Statement) { - statement = (Statement) this.assistNode; + index--; + } + if (ifStatement == null) { + return statement; + } + // collect all if statements with instanceof expressions that enclose the completion node + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=304006 + while (index >= 0) { + if (this.elementInfoStack[index] == IF && this.elementObjectInfoStack[index] instanceof InstanceOfExpression) { + InstanceOfExpression condition = (InstanceOfExpression)this.elementObjectInfoStack[index]; + ifStatement = + new IfStatement( + condition, + ifStatement, + condition.sourceStart, + ifStatement.sourceEnd); } - IfStatement ifStatement = - new IfStatement( - condition, - statement, - condition.sourceStart, - statement.sourceEnd); - this.enclosingNode = ifStatement; - return ifStatement; + index--; } - - return statement; + this.enclosingNode = ifStatement; + return ifStatement; } private void buildMoreGenericsCompletionContext(ASTNode node, boolean consumeTypeArguments) { int kind = topKnownElementKind(COMPLETION_OR_ASSIST_PARSER); @@ -2455,6 +2477,21 @@ protected void consumeClassHeaderExtends() { } } } +protected void consumeClassHeaderImplements() { + super.consumeClassHeaderImplements(); + if (this.assistNode != null && this.assistNodeParent == null) { + TypeDeclaration typeDecl = (TypeDeclaration) this.astStack[this.astPtr]; + if (typeDecl != null) { + TypeReference[] superInterfaces = typeDecl.superInterfaces; + int length = superInterfaces == null ? 0 : superInterfaces.length; + for (int i = 0; i < length; i++) { + if (superInterfaces[i] == this.assistNode) { + this.assistNodeParent = typeDecl; + } + } + } + } +} protected void consumeClassTypeElt() { pushOnElementStack(K_NEXT_TYPEREF_IS_EXCEPTION); super.consumeClassTypeElt(); @@ -5100,6 +5137,21 @@ public void reset() { this.sourceEnds = new HashtableOfObjectToInt(); } } + +/* + * To find out if the given stack has an instanceof expression + * at the given startIndex or at one prior to that + */ +private boolean stackHasInstanceOfExpression(Object[] stackToSearch, int startIndex) { + int indexInstanceOf = startIndex; + while (indexInstanceOf >= 0) { + if (stackToSearch[indexInstanceOf] instanceof InstanceOfExpression) { + return true; + } + indexInstanceOf--; + } + return false; +} /* * Reset internal state after completion is over */ diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java index 75e206145..b30b7a526 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java @@ -800,6 +800,8 @@ protected void consumeStaticImportOnDemandDeclarationName() { /* build specific assist node on import statement */ ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccStatic); reference.bits |= ASTNode.OnDemand; + // star end position + reference.trailingStarPosition = this.intStack[this.intPtr--]; this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; @@ -922,6 +924,8 @@ protected void consumeTypeImportOnDemandDeclarationName() { /* build specific assist node on import statement */ ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccDefault); reference.bits |= ASTNode.OnDemand; + // star end position + reference.trailingStarPosition = this.intStack[this.intPtr--]; this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java index c3c659a9a..2ad2d3bcd 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -38,10 +38,10 @@ public class SelectionOnPackageReference extends ImportReference { //{ObjectTeams: added: modifiers (for the sake of "team"): /* orig: public SelectionOnPackageReference(char[][] tokens , long[] positions) { - super(tokens, positions, true, ClassFileConstants.AccDefault); + super(tokens, positions, false, ClassFileConstants.AccDefault); :giro*/ public SelectionOnPackageReference(char[][] tokens , long[] positions, int modifiers) { - super(tokens, positions, true, modifiers); + super(tokens, positions, false, modifiers); // SH} } public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) { diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java index e0458b420..6d1484802 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -995,6 +995,8 @@ protected void consumeStaticImportOnDemandDeclarationName() { /* build specific assist node on import statement */ ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccStatic); reference.bits |= ASTNode.OnDemand; + // star end position + reference.trailingStarPosition = this.intStack[this.intPtr--]; this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; @@ -1076,6 +1078,8 @@ protected void consumeTypeImportOnDemandDeclarationName() { /* build specific assist node on import statement */ ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccDefault); reference.bits |= ASTNode.OnDemand; + // star end position + reference.trailingStarPosition = this.intStack[this.intPtr--]; this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java index 3d12a2db7..88e3a62b8 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -2097,7 +2097,7 @@ public static final int indexOf(final char[] toBeFound, final char[] array, fina public static final int indexOf(final char[] toBeFound, final char[] array, final boolean isCaseSensitive, final int start, final int end) { final int arrayLength = end; final int toBeFoundLength = toBeFound.length; - if (toBeFoundLength > arrayLength) return -1; + if (toBeFoundLength > arrayLength || start < 0) return -1; if (toBeFoundLength == 0) return 0; if (toBeFoundLength == arrayLength) { if (isCaseSensitive) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java index 26376051e..491fb0f80 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java @@ -814,6 +814,8 @@ void setSourceStart(int sourceStart); int TooManyFields = Internal + 432; /** @since 2.1 */ int TooManyMethods = Internal + 433; + /** @since 3.7 */ + int TooManyParametersForSyntheticMethod = Internal + 434; // 1.4 features // assertion warning diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java index 5695680d4..ffa104b2d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java @@ -48,10 +48,10 @@ import org.eclipse.jdt.internal.compiler.codegen.ExceptionLabel; import org.eclipse.jdt.internal.compiler.codegen.Opcodes; import org.eclipse.jdt.internal.compiler.codegen.StackMapFrame; import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream; -import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo; import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.ExceptionMarker; import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackDepthMarker; import org.eclipse.jdt.internal.compiler.codegen.StackMapFrameCodeStream.StackMarker; +import org.eclipse.jdt.internal.compiler.codegen.VerificationTypeInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.impl.StringConstant; @@ -61,7 +61,6 @@ import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; -import org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding; @@ -266,7 +265,6 @@ public class ClassFile implements TypeConstants, TypeIds { LookupEnvironment env = typeBinding.scope.environment(); return env.classFilePool.acquire(typeBinding); } - /** * INTERNAL USE-ONLY * This methods creates a new instance of the receiver. @@ -304,8 +302,8 @@ public class ClassFile implements TypeConstants, TypeIds { * @param methodBinding org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding */ public void addAbstractMethod( - AbstractMethodDeclaration method, - MethodBinding methodBinding) { + AbstractMethodDeclaration method, + MethodBinding methodBinding) { //{ObjectTeams: role ifc methods may have funny modifiers (static, callin), don't destroy the original binding if (methodBinding.declaringClass.isSynthInterface()) @@ -313,8 +311,8 @@ public class ClassFile implements TypeConstants, TypeIds { // SH} this.generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; - int attributeNumber = this.generateMethodInfoAttribute(methodBinding); - completeMethodInfo(methodAttributeOffset, attributeNumber); + int attributeNumber = this.generateMethodInfoAttributes(methodBinding); + completeMethodInfo(methodBinding, methodAttributeOffset, attributeNumber); } /** @@ -344,26 +342,7 @@ public class ClassFile implements TypeConstants, TypeIds { if (lastIndex != -1) { fullFileName = fullFileName.substring(lastIndex + 1, fullFileName.length()); } - // check that there is enough space to write all the bytes for the field info corresponding - // to the @fieldBinding - if (this.contentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int sourceAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.SourceName); - this.contents[this.contentsOffset++] = (byte) (sourceAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) sourceAttributeNameIndex; - // The length of a source file attribute is 2. This is a fixed-length - // attribute - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 2; - // write the source file name - int fileNameIndex = this.constantPool.literalIndex(fullFileName.toCharArray()); - this.contents[this.contentsOffset++] = (byte) (fileNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) fileNameIndex; - attributesNumber++; + attributesNumber += generateSourceAttribute(fullFileName); } //{ObjectTeams: write OT-specific attributes: attributesNumber += ModelElement.writeAttributes(this.referenceBinding, this); @@ -392,81 +371,18 @@ public class ClassFile implements TypeConstants, TypeIds { if (this.referenceBinding.isDeprecated()) { // check that there is enough space to write all the bytes for the field info corresponding // to the @fieldBinding - if (this.contentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - int deprecatedAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.DeprecatedName); - this.contents[this.contentsOffset++] = (byte) (deprecatedAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) deprecatedAttributeNameIndex; - // the length of a deprecated attribute is equals to 0 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - attributesNumber++; + attributesNumber += generateDeprecatedAttribute(); } // add signature attribute char[] genericSignature = this.referenceBinding.genericSignature(); if (genericSignature != null) { - // check that there is enough space to write all the bytes for the field info corresponding - // to the @fieldBinding - if (this.contentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int signatureAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.SignatureName); - this.contents[this.contentsOffset++] = (byte) (signatureAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) signatureAttributeNameIndex; - // the length of a signature attribute is equals to 2 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 2; - int signatureIndex = - this.constantPool.literalIndex(genericSignature); - this.contents[this.contentsOffset++] = (byte) (signatureIndex >> 8); - this.contents[this.contentsOffset++] = (byte) signatureIndex; - attributesNumber++; + attributesNumber += generateSignatureAttribute(genericSignature); } if (this.targetJDK >= ClassFileConstants.JDK1_5 && this.referenceBinding.isNestedType() && !this.referenceBinding.isMemberType()) { // add enclosing method attribute (1.5 mode only) - if (this.contentsOffset + 10 >= this.contents.length) { - resizeContents(10); - } - int enclosingMethodAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.EnclosingMethodName); - this.contents[this.contentsOffset++] = (byte) (enclosingMethodAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) enclosingMethodAttributeNameIndex; - // the length of a signature attribute is equals to 2 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 4; - - int enclosingTypeIndex = this.constantPool.literalIndexForType(this.referenceBinding.enclosingType().constantPoolName()); - this.contents[this.contentsOffset++] = (byte) (enclosingTypeIndex >> 8); - this.contents[this.contentsOffset++] = (byte) enclosingTypeIndex; - byte methodIndexByte1 = 0; - byte methodIndexByte2 = 0; - if (this.referenceBinding instanceof LocalTypeBinding) { - MethodBinding methodBinding = ((LocalTypeBinding) this.referenceBinding).enclosingMethod; - if (methodBinding != null) { -//{ObjectTeams: static role methods need to know the constant pool declaring class: -/* orig: - int enclosingMethodIndex = this.constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature(this)); - :giro */ - int enclosingMethodIndex = this.constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature(this, this.referenceBinding)); -// SH} - methodIndexByte1 = (byte) (enclosingMethodIndex >> 8); - methodIndexByte2 = (byte) enclosingMethodIndex; - } - } - this.contents[this.contentsOffset++] = methodIndexByte1; - this.contents[this.contentsOffset++] = methodIndexByte2; - attributesNumber++; + attributesNumber += generateEnclosingMethodAttribute(); } if (this.targetJDK >= ClassFileConstants.JDK1_4) { TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext; @@ -487,20 +403,7 @@ public class ClassFile implements TypeConstants, TypeIds { for (int i = 0, max = superInterfaces.length; i < max; i++) { this.missingTypes = superInterfaces[i].collectMissingTypes(this.missingTypes); } - // add an attribute for inconsistent hierarchy - if (this.contentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - int inconsistentHierarchyNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.InconsistentHierarchy); - this.contents[this.contentsOffset++] = (byte) (inconsistentHierarchyNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) inconsistentHierarchyNameIndex; - // the length of an inconsistent hierarchy attribute is equals to 0 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - attributesNumber++; + attributesNumber += generateHierarchyInconsistentAttribute(); } // Inner class attribute int numberOfInnerClasses = this.innerClassesBindings == null ? 0 : this.innerClassesBindings.size(); @@ -514,75 +417,7 @@ public class ClassFile implements TypeConstants, TypeIds { return CharOperation.compareTo(binding1.constantPoolName(), binding2.constantPoolName()); } }); - // Generate the inner class attribute - int exSize = 8 * numberOfInnerClasses + 8; - if (exSize + this.contentsOffset >= this.contents.length) { - resizeContents(exSize); - } - // Now we now the size of the attribute and the number of entries - // attribute name - int attributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.InnerClassName); - this.contents[this.contentsOffset++] = (byte) (attributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) attributeNameIndex; - int value = (numberOfInnerClasses << 3) + 2; - this.contents[this.contentsOffset++] = (byte) (value >> 24); - this.contents[this.contentsOffset++] = (byte) (value >> 16); - this.contents[this.contentsOffset++] = (byte) (value >> 8); - this.contents[this.contentsOffset++] = (byte) value; - this.contents[this.contentsOffset++] = (byte) (numberOfInnerClasses >> 8); - this.contents[this.contentsOffset++] = (byte) numberOfInnerClasses; - for (int i = 0; i < numberOfInnerClasses; i++) { - ReferenceBinding innerClass = innerClasses[i]; - int accessFlags = innerClass.getAccessFlags(); -//{ObjectTeams: synthetic interfaces are illegal in class files (why???): - if ( (accessFlags & (ClassFileConstants.AccSynthetic|ClassFileConstants.AccInterface)) - == (ClassFileConstants.AccSynthetic|ClassFileConstants.AccInterface)) - { - accessFlags ^= ClassFileConstants.AccSynthetic; - } -//SH} - int innerClassIndex = this.constantPool.literalIndexForType(innerClass.constantPoolName()); - // inner class index - this.contents[this.contentsOffset++] = (byte) (innerClassIndex >> 8); - this.contents[this.contentsOffset++] = (byte) innerClassIndex; - // outer class index: anonymous and local have no outer class index - if (innerClass.isMemberType()) { - // member or member of local - int outerClassIndex = this.constantPool.literalIndexForType(innerClass.enclosingType().constantPoolName()); - this.contents[this.contentsOffset++] = (byte) (outerClassIndex >> 8); - this.contents[this.contentsOffset++] = (byte) outerClassIndex; - } else { - // equals to 0 if the innerClass is not a member type - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - } - // name index - if (!innerClass.isAnonymousType()) { -//{ObjectTeams: use real name not beautified version (was sourceName()). -/* orig: - int nameIndex = this.constantPool.literalIndex(innerClass.sourceName()); - :giro */ - int nameIndex = this.constantPool.literalIndex(innerClass.internalName()); -// SH} - - this.contents[this.contentsOffset++] = (byte) (nameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) nameIndex; - } else { - // equals to 0 if the innerClass is an anonymous type - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - } - // access flag - if (innerClass.isAnonymousType()) { - accessFlags &= ~ClassFileConstants.AccFinal; - } else if (innerClass.isMemberType() && innerClass.isInterface()) { - accessFlags |= ClassFileConstants.AccStatic; // implicitely static - } - this.contents[this.contentsOffset++] = (byte) (accessFlags >> 8); - this.contents[this.contentsOffset++] = (byte) accessFlags; - } - attributesNumber++; + attributesNumber += generateInnerClassAttribute(numberOfInnerClasses, innerClasses); } if (this.missingTypes != null) { generateMissingTypesAttribute(); @@ -602,7 +437,6 @@ public class ClassFile implements TypeConstants, TypeIds { this.header[this.constantPoolOffset++] = (byte) (constantPoolCount >> 8); this.header[this.constantPoolOffset] = (byte) constantPoolCount; } - /** * INTERNAL USE-ONLY * This methods generate all the default abstract method infos that correpond to @@ -612,10 +446,11 @@ public class ClassFile implements TypeConstants, TypeIds { MethodBinding[] defaultAbstractMethods = this.referenceBinding.getDefaultAbstractMethods(); for (int i = 0, max = defaultAbstractMethods.length; i < max; i++) { - generateMethodInfoHeader(defaultAbstractMethods[i]); + MethodBinding methodBinding = defaultAbstractMethods[i]; + generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; - int attributeNumber = generateMethodInfoAttribute(defaultAbstractMethods[i]); - completeMethodInfo(methodAttributeOffset, attributeNumber); + int attributeNumber = generateMethodInfoAttributes(methodBinding); + completeMethodInfo(methodBinding, methodAttributeOffset, attributeNumber); } } @@ -625,133 +460,18 @@ public class ClassFile implements TypeConstants, TypeIds { // Generate the constantValueAttribute Constant fieldConstant = fieldBinding.constant(); if (fieldConstant != Constant.NotAConstant){ - if (this.contentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - // Now we generate the constant attribute corresponding to the fieldBinding - int constantValueNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.ConstantValueName); - this.contents[this.contentsOffset++] = (byte) (constantValueNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) constantValueNameIndex; - // The attribute length = 2 in case of a constantValue attribute - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 2; - attributesNumber++; - // Need to add the constant_value_index - switch (fieldConstant.typeID()) { - case T_boolean : - int booleanValueIndex = - this.constantPool.literalIndex(fieldConstant.booleanValue() ? 1 : 0); - this.contents[this.contentsOffset++] = (byte) (booleanValueIndex >> 8); - this.contents[this.contentsOffset++] = (byte) booleanValueIndex; - break; - case T_byte : - case T_char : - case T_int : - case T_short : - int integerValueIndex = - this.constantPool.literalIndex(fieldConstant.intValue()); - this.contents[this.contentsOffset++] = (byte) (integerValueIndex >> 8); - this.contents[this.contentsOffset++] = (byte) integerValueIndex; - break; - case T_float : - int floatValueIndex = - this.constantPool.literalIndex(fieldConstant.floatValue()); - this.contents[this.contentsOffset++] = (byte) (floatValueIndex >> 8); - this.contents[this.contentsOffset++] = (byte) floatValueIndex; - break; - case T_double : - int doubleValueIndex = - this.constantPool.literalIndex(fieldConstant.doubleValue()); - this.contents[this.contentsOffset++] = (byte) (doubleValueIndex >> 8); - this.contents[this.contentsOffset++] = (byte) doubleValueIndex; - break; - case T_long : - int longValueIndex = - this.constantPool.literalIndex(fieldConstant.longValue()); - this.contents[this.contentsOffset++] = (byte) (longValueIndex >> 8); - this.contents[this.contentsOffset++] = (byte) longValueIndex; - break; - case T_JavaLangString : - int stringValueIndex = - this.constantPool.literalIndex( - ((StringConstant) fieldConstant).stringValue()); - if (stringValueIndex == -1) { - if (!this.creatingProblemType) { - // report an error and abort: will lead to a problem type classfile creation - TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext; - FieldDeclaration[] fieldDecls = typeDeclaration.fields; - for (int i = 0, max = fieldDecls.length; i < max; i++) { - if (fieldDecls[i].binding == fieldBinding) { - // problem should abort - typeDeclaration.scope.problemReporter().stringConstantIsExceedingUtf8Limit( - fieldDecls[i]); - } - } - } else { - // already inside a problem type creation : no constant for this field - this.contentsOffset = fieldAttributeOffset; - } - } else { - this.contents[this.contentsOffset++] = (byte) (stringValueIndex >> 8); - this.contents[this.contentsOffset++] = (byte) stringValueIndex; - } - } + attributesNumber += generateConstantValueAttribute(fieldConstant, fieldBinding, fieldAttributeOffset); } if (this.targetJDK < ClassFileConstants.JDK1_5 && fieldBinding.isSynthetic()) { - if (this.contentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - int syntheticAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.SyntheticName); - this.contents[this.contentsOffset++] = (byte) (syntheticAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) syntheticAttributeNameIndex; - // the length of a synthetic attribute is equals to 0 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - attributesNumber++; + attributesNumber += generateSyntheticAttribute(); } if (fieldBinding.isDeprecated()) { - if (this.contentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - int deprecatedAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.DeprecatedName); - this.contents[this.contentsOffset++] = (byte) (deprecatedAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) deprecatedAttributeNameIndex; - // the length of a deprecated attribute is equals to 0 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - attributesNumber++; + attributesNumber += generateDeprecatedAttribute(); } // add signature attribute char[] genericSignature = fieldBinding.genericSignature(); if (genericSignature != null) { - // check that there is enough space to write all the bytes for the field info corresponding - // to the @fieldBinding - if (this.contentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int signatureAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.SignatureName); - this.contents[this.contentsOffset++] = (byte) (signatureAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) signatureAttributeNameIndex; - // the length of a signature attribute is equals to 2 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 2; - int signatureIndex = - this.constantPool.literalIndex(genericSignature); - this.contents[this.contentsOffset++] = (byte) (signatureIndex >> 8); - this.contents[this.contentsOffset++] = (byte) signatureIndex; - attributesNumber++; + attributesNumber += generateSignatureAttribute(genericSignature); } if (this.targetJDK >= ClassFileConstants.JDK1_4) { FieldDeclaration fieldDeclaration = fieldBinding.sourceField(); @@ -869,7 +589,7 @@ public class ClassFile implements TypeConstants, TypeIds { // always clear the strictfp/native/abstract bit for a problem method generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); int methodAttributeOffset = this.contentsOffset; - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute attributeNumber++; @@ -894,7 +614,7 @@ public class ClassFile implements TypeConstants, TypeIds { compilationResult.getLineSeparatorPositions(), problem.getSourceLineNumber()); - completeMethodInfo(methodAttributeOffset, attributeNumber); + completeMethodInfo(methodBinding, methodAttributeOffset, attributeNumber); } /** @@ -951,6 +671,7 @@ public class ClassFile implements TypeConstants, TypeIds { this.contents[attributeOffset++] = (byte) (attributeNumber >> 8); this.contents[attributeOffset] = (byte) attributeNumber; } + /** * INTERNAL USE-ONLY * Generate the byte for a problem method info that correspond to a boggus constructor. @@ -967,10 +688,10 @@ public class ClassFile implements TypeConstants, TypeIds { // always clear the strictfp/native/abstract bit for a problem method generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); int methodAttributeOffset = this.contentsOffset; - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributesNumber = generateMethodInfoAttributes(methodBinding); // Code attribute - attributeNumber++; + attributesNumber++; int codeAttributeOffset = this.contentsOffset; generateCodeAttributeHeader(); this.codeStream.reset(method, this); @@ -1010,7 +731,7 @@ public class ClassFile implements TypeConstants, TypeIds { .compilationResult .getLineSeparatorPositions(), problemLine); - completeMethodInfo(methodAttributeOffset, attributeNumber); + completeMethodInfo(methodBinding, methodAttributeOffset, attributesNumber); } /** * INTERNAL USE-ONLY @@ -1032,7 +753,6 @@ public class ClassFile implements TypeConstants, TypeIds { this.methodCount--; // we need to remove the method that causes the problem addProblemConstructor(method, methodBinding, problems); } - /** * INTERNAL USE-ONLY * Generate the byte for a problem method info that correspond to a boggus method. @@ -1051,14 +771,14 @@ public class ClassFile implements TypeConstants, TypeIds { // always clear the strictfp/native/abstract bit for a problem method generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); int methodAttributeOffset = this.contentsOffset; - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributesNumber = generateMethodInfoAttributes(methodBinding); //{ObjectTeams: write OT-specific byte code attributes if (method.model != null) - attributeNumber += method.model.writeAttributes(this); + attributesNumber += method.model.writeAttributes(this); // SH} // Code attribute - attributeNumber++; + attributesNumber++; int codeAttributeOffset = this.contentsOffset; generateCodeAttributeHeader(); @@ -1103,7 +823,7 @@ public class ClassFile implements TypeConstants, TypeIds { .compilationResult .getLineSeparatorPositions(), problemLine); - completeMethodInfo(methodAttributeOffset, attributeNumber); + completeMethodInfo(methodBinding, methodAttributeOffset, attributesNumber); } /** @@ -1143,10 +863,11 @@ public class ClassFile implements TypeConstants, TypeIds { MethodBinding[] defaultAbstractMethods = this.referenceBinding.getDefaultAbstractMethods(); for (int i = 0, max = defaultAbstractMethods.length; i < max; i++) { - generateMethodInfoHeader(defaultAbstractMethods[i]); + MethodBinding methodBinding = defaultAbstractMethods[i]; + generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; - int attributeNumber = generateMethodInfoAttribute(defaultAbstractMethods[i]); - completeMethodInfo(methodAttributeOffset, attributeNumber); + int attributeNumber = generateMethodInfoAttributes(methodBinding); + completeMethodInfo(methodBinding, methodAttributeOffset, attributeNumber); } // add synthetic methods infos SyntheticMethodBinding[] syntheticMethods = this.referenceBinding.syntheticMethods(); @@ -1206,7 +927,7 @@ public class ClassFile implements TypeConstants, TypeIds { generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; // this will add exception attribute, synthetic attribute, deprecated attribute,... - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute int codeAttributeOffset = this.contentsOffset; attributeNumber++; // add code attribute @@ -1236,7 +957,7 @@ public class ClassFile implements TypeConstants, TypeIds { generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; // this will add exception attribute, synthetic attribute, deprecated attribute,... - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute int codeAttributeOffset = this.contentsOffset; attributeNumber++; // add code attribute @@ -1266,7 +987,7 @@ public class ClassFile implements TypeConstants, TypeIds { generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; // this will add exception attribute, synthetic attribute, deprecated attribute,... - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute int codeAttributeOffset = this.contentsOffset; attributeNumber++; // add code attribute @@ -1297,7 +1018,7 @@ public class ClassFile implements TypeConstants, TypeIds { generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; // this will add exception attribute, synthetic attribute, deprecated attribute,... - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute int codeAttributeOffset = this.contentsOffset; attributeNumber++; // add code attribute @@ -1328,7 +1049,7 @@ public class ClassFile implements TypeConstants, TypeIds { generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; // this will add exception attribute, synthetic attribute, deprecated attribute,... - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute int codeAttributeOffset = this.contentsOffset; attributeNumber++; // add code attribute @@ -1358,7 +1079,7 @@ public class ClassFile implements TypeConstants, TypeIds { generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; // this will add exception attribute, synthetic attribute, deprecated attribute,... - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute int codeAttributeOffset = this.contentsOffset; attributeNumber++; // add code attribute @@ -1386,7 +1107,7 @@ public class ClassFile implements TypeConstants, TypeIds { generateMethodInfoHeader(methodBinding); int methodAttributeOffset = this.contentsOffset; // this will add exception attribute, synthetic attribute, deprecated attribute,... - int attributeNumber = generateMethodInfoAttribute(methodBinding); + int attributeNumber = generateMethodInfoAttributes(methodBinding); // Code attribute int codeAttributeOffset = this.contentsOffset; attributeNumber++; // add code attribute @@ -1470,7 +1191,7 @@ public class ClassFile implements TypeConstants, TypeIds { Messages.bind(Messages.abort_invalidExceptionAttribute, new String(this.codeStream.methodDeclaration.selector)), this.codeStream.methodDeclaration); } - while (iRange < maxRange) { + while (iRange < maxRange) { int start = exceptionLabel.ranges[iRange++]; // even ranges are start positions this.contents[localContentsOffset++] = (byte) (start >> 8); this.contents[localContentsOffset++] = (byte) start; @@ -1505,752 +1226,52 @@ public class ClassFile implements TypeConstants, TypeIds { } // debug attributes int codeAttributeAttributeOffset = localContentsOffset; - int attributeNumber = 0; + int attributesNumber = 0; // leave two bytes for the attribute_length localContentsOffset += 2; if (localContentsOffset + 2 >= this.contents.length) { resizeContents(2); } + this.contentsOffset = localContentsOffset; + // first we handle the linenumber attribute if ((this.produceAttributes & ClassFileConstants.ATTR_LINES) != 0) { - /* Create and add the line number attribute (used for debugging) - * Build the pairs of: - * (bytecodePC lineNumber) - * according to the table of start line indexes and the pcToSourceMap table - * contained into the codestream - */ - int[] pcToSourceMapTable; - if (((pcToSourceMapTable = this.codeStream.pcToSourceMap) != null) - && (this.codeStream.pcToSourceMapSize != 0)) { - int lineNumberNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; - int lineNumberTableOffset = localContentsOffset; - localContentsOffset += 6; - // leave space for attribute_length and line_number_table_length - int numberOfEntries = 0; - int length = this.codeStream.pcToSourceMapSize; - for (int i = 0; i < length;) { - // write the entry - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int pc = pcToSourceMapTable[i++]; - this.contents[localContentsOffset++] = (byte) (pc >> 8); - this.contents[localContentsOffset++] = (byte) pc; - int lineNumber = pcToSourceMapTable[i++]; - this.contents[localContentsOffset++] = (byte) (lineNumber >> 8); - this.contents[localContentsOffset++] = (byte) lineNumber; - numberOfEntries++; - } - // now we change the size of the line number attribute - int lineNumberAttr_length = numberOfEntries * 4 + 2; - this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 24); - this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 16); - this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 8); - this.contents[lineNumberTableOffset++] = (byte) lineNumberAttr_length; - this.contents[lineNumberTableOffset++] = (byte) (numberOfEntries >> 8); - this.contents[lineNumberTableOffset++] = (byte) numberOfEntries; - attributeNumber++; - } + attributesNumber += generateLineNumberAttribute(); } // then we do the local variable attribute if ((this.produceAttributes & ClassFileConstants.ATTR_VARS) != 0) { - int numberOfEntries = 0; - int localVariableNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTableName); final boolean methodDeclarationIsStatic = this.codeStream.methodDeclaration.isStatic(); - int maxOfEntries = 8 + 10 * (methodDeclarationIsStatic ? 0 : 1); - for (int i = 0; i < this.codeStream.allLocalsCounter; i++) { - LocalVariableBinding localVariableBinding = this.codeStream.locals[i]; - maxOfEntries += 10 * localVariableBinding.initializationCount; - } - // reserve enough space - if (localContentsOffset + maxOfEntries >= this.contents.length) { - resizeContents(maxOfEntries); - } - this.contents[localContentsOffset++] = (byte) (localVariableNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableNameIndex; - int localVariableTableOffset = localContentsOffset; - // leave space for attribute_length and local_variable_table_length - localContentsOffset += 6; - int nameIndex; - int descriptorIndex; - SourceTypeBinding declaringClassBinding = null; - if (!methodDeclarationIsStatic) { - numberOfEntries++; - this.contents[localContentsOffset++] = 0; // the startPC for this is always 0 - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = this.constantPool.literalIndex(ConstantPool.This); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - declaringClassBinding = (SourceTypeBinding) this.codeStream.methodDeclaration.binding.declaringClass; - descriptorIndex = - this.constantPool.literalIndex( - declaringClassBinding.signature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0 - this.contents[localContentsOffset++] = 0; - } - // used to remember the local variable with a generic type - int genericLocalVariablesCounter = 0; - LocalVariableBinding[] genericLocalVariables = null; - int numberOfGenericEntries = 0; - - for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) { - LocalVariableBinding localVariable = this.codeStream.locals[i]; - if (localVariable.declaration == null) continue; - final TypeBinding localVariableTypeBinding = localVariable.type; - boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable(); - if (localVariable.initializationCount != 0 && isParameterizedType) { - if (genericLocalVariables == null) { - // we cannot have more than max locals - genericLocalVariables = new LocalVariableBinding[max]; - } - genericLocalVariables[genericLocalVariablesCounter++] = localVariable; - } - for (int j = 0; j < localVariable.initializationCount; j++) { - int startPC = localVariable.initializationPCs[j << 1]; - int endPC = localVariable.initializationPCs[(j << 1) + 1]; - if (startPC != endPC) { // only entries for non zero length - if (endPC == -1) { - localVariable.declaringScope.problemReporter().abortDueToInternalError( - Messages.bind(Messages.abort_invalidAttribute, new String(localVariable.name)), - (ASTNode) localVariable.declaringScope.methodScope().referenceContext); - } - if (isParameterizedType) { - numberOfGenericEntries++; - } - // now we can safely add the local entry - numberOfEntries++; - this.contents[localContentsOffset++] = (byte) (startPC >> 8); - this.contents[localContentsOffset++] = (byte) startPC; - int length = endPC - startPC; - this.contents[localContentsOffset++] = (byte) (length >> 8); - this.contents[localContentsOffset++] = (byte) length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariableTypeBinding.signature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } - int value = numberOfEntries * 10 + 2; - this.contents[localVariableTableOffset++] = (byte) (value >> 24); - this.contents[localVariableTableOffset++] = (byte) (value >> 16); - this.contents[localVariableTableOffset++] = (byte) (value >> 8); - this.contents[localVariableTableOffset++] = (byte) value; - this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8); - this.contents[localVariableTableOffset] = (byte) numberOfEntries; - attributeNumber++; - - final boolean currentInstanceIsGeneric = - !methodDeclarationIsStatic - && declaringClassBinding != null - && declaringClassBinding.typeVariables != Binding.NO_TYPE_VARIABLES; - if (genericLocalVariablesCounter != 0 || currentInstanceIsGeneric) { - // add the local variable type table attribute - numberOfGenericEntries += (currentInstanceIsGeneric ? 1 : 0); - maxOfEntries = 8 + numberOfGenericEntries * 10; - // reserve enough space - if (localContentsOffset + maxOfEntries >= this.contents.length) { - resizeContents(maxOfEntries); - } - int localVariableTypeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName); - this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex; - value = numberOfGenericEntries * 10 + 2; - this.contents[localContentsOffset++] = (byte) (value >> 24); - this.contents[localContentsOffset++] = (byte) (value >> 16); - this.contents[localContentsOffset++] = (byte) (value >> 8); - this.contents[localContentsOffset++] = (byte) value; - this.contents[localContentsOffset++] = (byte) (numberOfGenericEntries >> 8); - this.contents[localContentsOffset++] = (byte) numberOfGenericEntries; - if (currentInstanceIsGeneric) { - this.contents[localContentsOffset++] = 0; // the startPC for this is always 0 - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = this.constantPool.literalIndex(ConstantPool.This); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(declaringClassBinding.genericTypeSignature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0 - this.contents[localContentsOffset++] = 0; - } - - for (int i = 0; i < genericLocalVariablesCounter; i++) { - LocalVariableBinding localVariable = genericLocalVariables[i]; - for (int j = 0; j < localVariable.initializationCount; j++) { - int startPC = localVariable.initializationPCs[j << 1]; - int endPC = localVariable.initializationPCs[(j << 1) + 1]; - if (startPC != endPC) { - // only entries for non zero length - // now we can safely add the local entry - this.contents[localContentsOffset++] = (byte) (startPC >> 8); - this.contents[localContentsOffset++] = (byte) startPC; - int length = endPC - startPC; - this.contents[localContentsOffset++] = (byte) (length >> 8); - this.contents[localContentsOffset++] = (byte) length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariable.type.genericTypeSignature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } - attributeNumber++; - } + attributesNumber += generateLocalVariableTableAttribute(code_length, methodDeclarationIsStatic, false); } if (addStackMaps) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(this.codeStream.methodDeclaration.binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapTableAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapTableName); - this.contents[localContentsOffset++] = (byte) (stackMapTableAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapTableAttributeNameIndex; - - int stackMapTableAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - StackMapFrame prevFrame = null; - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - prevFrame = currentFrame; - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int offsetDelta = currentFrame.getOffsetDelta(prevFrame); - switch (currentFrame.getFrameType(prevFrame)) { - case StackMapFrame.APPEND_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - int numberOfDifferentLocals = currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 + numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int index = currentFrame.getIndexOfDifferentLocals(numberOfDifferentLocals); - int numberOfLocals = currentFrame.getNumberOfLocals(); - for (int i = index; i < currentFrame.locals.length && numberOfDifferentLocals > 0; i++) { - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfDifferentLocals--; - } - } - break; - case StackMapFrame.SAME_FRAME : - if (localContentsOffset + 1 >= this.contents.length) { - resizeContents(1); - } - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_FRAME_EXTENDED : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - this.contents[localContentsOffset++] = (byte) 251; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.CHOP_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - numberOfDifferentLocals = -currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 - numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS : - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[localContentsOffset++] = (byte) (offsetDelta + 64); - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS_EXTENDED : - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - this.contents[localContentsOffset++] = (byte) 247; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - default : - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) 255; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - 4; - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapTableAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapTableAttribute( + this.codeStream.methodDeclaration.binding, + code_length, + codeAttributeOffset, + max_locals, + false); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(this.codeStream.methodDeclaration.binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapName); - this.contents[localContentsOffset++] = (byte) (stackMapAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapAttributeNameIndex; - - int stackMapAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int frameOffset = currentFrame.pc; - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) (frameOffset >> 8); - this.contents[localContentsOffset++] = (byte) frameOffset; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - int numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - 4; - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapAttribute( + this.codeStream.methodDeclaration.binding, + code_length, + codeAttributeOffset, + max_locals, + false); } - this.contents[codeAttributeAttributeOffset++] = (byte) (attributeNumber >> 8); - this.contents[codeAttributeAttributeOffset] = (byte) attributeNumber; + this.contents[codeAttributeAttributeOffset++] = (byte) (attributesNumber >> 8); + this.contents[codeAttributeAttributeOffset] = (byte) attributesNumber; // update the attribute length - int codeAttributeLength = localContentsOffset - (codeAttributeOffset + 6); + int codeAttributeLength = this.contentsOffset - (codeAttributeOffset + 6); this.contents[codeAttributeOffset + 2] = (byte) (codeAttributeLength >> 24); this.contents[codeAttributeOffset + 3] = (byte) (codeAttributeLength >> 16); this.contents[codeAttributeOffset + 4] = (byte) (codeAttributeLength >> 8); this.contents[codeAttributeOffset + 5] = (byte) codeAttributeLength; - this.contentsOffset = localContentsOffset; } /** @@ -2351,703 +1372,40 @@ public class ClassFile implements TypeConstants, TypeIds { } // debug attributes int codeAttributeAttributeOffset = localContentsOffset; - int attributeNumber = 0; + int attributesNumber = 0; // leave two bytes for the attribute_length localContentsOffset += 2; if (localContentsOffset + 2 >= this.contents.length) { resizeContents(2); } + this.contentsOffset = localContentsOffset; + // first we handle the linenumber attribute if ((this.produceAttributes & ClassFileConstants.ATTR_LINES) != 0) { - /* Create and add the line number attribute (used for debugging) - * Build the pairs of: - * (bytecodePC lineNumber) - * according to the table of start line indexes and the pcToSourceMap table - * contained into the codestream - */ - int[] pcToSourceMapTable; - if (((pcToSourceMapTable = this.codeStream.pcToSourceMap) != null) - && (this.codeStream.pcToSourceMapSize != 0)) { - int lineNumberNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; - int lineNumberTableOffset = localContentsOffset; - localContentsOffset += 6; - // leave space for attribute_length and line_number_table_length - int numberOfEntries = 0; - int length = this.codeStream.pcToSourceMapSize; - for (int i = 0; i < length;) { - // write the entry - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int pc = pcToSourceMapTable[i++]; - this.contents[localContentsOffset++] = (byte) (pc >> 8); - this.contents[localContentsOffset++] = (byte) pc; - int lineNumber = pcToSourceMapTable[i++]; - this.contents[localContentsOffset++] = (byte) (lineNumber >> 8); - this.contents[localContentsOffset++] = (byte) lineNumber; - numberOfEntries++; - } - // now we change the size of the line number attribute - int lineNumberAttr_length = numberOfEntries * 4 + 2; - this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 24); - this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 16); - this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 8); - this.contents[lineNumberTableOffset++] = (byte) lineNumberAttr_length; - this.contents[lineNumberTableOffset++] = (byte) (numberOfEntries >> 8); - this.contents[lineNumberTableOffset++] = (byte) numberOfEntries; - attributeNumber++; - } + attributesNumber += generateLineNumberAttribute(); } // then we do the local variable attribute if ((this.produceAttributes & ClassFileConstants.ATTR_VARS) != 0) { - int numberOfEntries = 0; - // codeAttribute.addLocalVariableTableAttribute(this); - if ((this.codeStream.pcToSourceMap != null) - && (this.codeStream.pcToSourceMapSize != 0)) { - int localVariableNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTableName); - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - this.contents[localContentsOffset++] = (byte) (localVariableNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableNameIndex; - int localVariableTableOffset = localContentsOffset; - localContentsOffset += 6; - - // leave space for attribute_length and local_variable_table_length - int nameIndex; - int descriptorIndex; - - // used to remember the local variable with a generic type - int genericLocalVariablesCounter = 0; - LocalVariableBinding[] genericLocalVariables = null; - int numberOfGenericEntries = 0; - - for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) { - LocalVariableBinding localVariable = this.codeStream.locals[i]; - if (localVariable.declaration == null) continue; - final TypeBinding localVariableTypeBinding = localVariable.type; - boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable(); - if (localVariable.initializationCount != 0 && isParameterizedType) { - if (genericLocalVariables == null) { - // we cannot have more than max locals - genericLocalVariables = new LocalVariableBinding[max]; - } - genericLocalVariables[genericLocalVariablesCounter++] = localVariable; - } - for (int j = 0; j < localVariable.initializationCount; j++) { - int startPC = localVariable.initializationPCs[j << 1]; - int endPC = localVariable.initializationPCs[(j << 1) + 1]; - if (startPC != endPC) { // only entries for non zero length - if (endPC == -1) { - localVariable.declaringScope.problemReporter().abortDueToInternalError( - Messages.bind(Messages.abort_invalidAttribute, new String(localVariable.name)), - (ASTNode) localVariable.declaringScope.methodScope().referenceContext); - } - if (localContentsOffset + 10 >= this.contents.length) { - resizeContents(10); - } - // now we can safely add the local entry - numberOfEntries++; - if (isParameterizedType) { - numberOfGenericEntries++; - } - this.contents[localContentsOffset++] = (byte) (startPC >> 8); - this.contents[localContentsOffset++] = (byte) startPC; - int length = endPC - startPC; - this.contents[localContentsOffset++] = (byte) (length >> 8); - this.contents[localContentsOffset++] = (byte) length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariableTypeBinding.signature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } - int value = numberOfEntries * 10 + 2; - this.contents[localVariableTableOffset++] = (byte) (value >> 24); - this.contents[localVariableTableOffset++] = (byte) (value >> 16); - this.contents[localVariableTableOffset++] = (byte) (value >> 8); - this.contents[localVariableTableOffset++] = (byte) value; - this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8); - this.contents[localVariableTableOffset] = (byte) numberOfEntries; - attributeNumber++; - - if (genericLocalVariablesCounter != 0) { - // add the local variable type table attribute - // reserve enough space - int maxOfEntries = 8 + numberOfGenericEntries * 10; - - if (localContentsOffset + maxOfEntries >= this.contents.length) { - resizeContents(maxOfEntries); - } - int localVariableTypeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName); - this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex; - value = numberOfGenericEntries * 10 + 2; - this.contents[localContentsOffset++] = (byte) (value >> 24); - this.contents[localContentsOffset++] = (byte) (value >> 16); - this.contents[localContentsOffset++] = (byte) (value >> 8); - this.contents[localContentsOffset++] = (byte) value; - this.contents[localContentsOffset++] = (byte) (numberOfGenericEntries >> 8); - this.contents[localContentsOffset++] = (byte) numberOfGenericEntries; - for (int i = 0; i < genericLocalVariablesCounter; i++) { - LocalVariableBinding localVariable = genericLocalVariables[i]; - for (int j = 0; j < localVariable.initializationCount; j++) { - int startPC = localVariable.initializationPCs[j << 1]; - int endPC = localVariable.initializationPCs[(j << 1) + 1]; - if (startPC != endPC) { // only entries for non zero length - // now we can safely add the local entry - this.contents[localContentsOffset++] = (byte) (startPC >> 8); - this.contents[localContentsOffset++] = (byte) startPC; - int length = endPC - startPC; - this.contents[localContentsOffset++] = (byte) (length >> 8); - this.contents[localContentsOffset++] = (byte) length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariable.type.genericTypeSignature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } - attributeNumber++; - } - } + attributesNumber += generateLocalVariableTableAttribute(code_length, true, false); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP_TABLE) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(null, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, true); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapTableAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapTableName); - this.contents[localContentsOffset++] = (byte) (stackMapTableAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapTableAttributeNameIndex; - - int stackMapTableAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - StackMapFrame prevFrame = null; - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - prevFrame = currentFrame; - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int offsetDelta = currentFrame.getOffsetDelta(prevFrame); - switch (currentFrame.getFrameType(prevFrame)) { - case StackMapFrame.APPEND_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - int numberOfDifferentLocals = currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 + numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int index = currentFrame.getIndexOfDifferentLocals(numberOfDifferentLocals); - int numberOfLocals = currentFrame.getNumberOfLocals(); - for (int i = index; i < currentFrame.locals.length && numberOfDifferentLocals > 0; i++) { - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfDifferentLocals--; - } - } - break; - case StackMapFrame.SAME_FRAME : - if (localContentsOffset + 1 >= this.contents.length) { - resizeContents(1); - } - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_FRAME_EXTENDED : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - this.contents[localContentsOffset++] = (byte) 251; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.CHOP_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - numberOfDifferentLocals = -currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 - numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS : - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[localContentsOffset++] = (byte) (offsetDelta + 64); - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS_EXTENDED : - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - this.contents[localContentsOffset++] = (byte) 247; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - default : - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) 255; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - 4; - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapTableAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapTableAttribute( + null, + code_length, + codeAttributeOffset, + max_locals, + true); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(this.codeStream.methodDeclaration.binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapName); - this.contents[localContentsOffset++] = (byte) (stackMapAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapAttributeNameIndex; - - int stackMapAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int frameOffset = currentFrame.pc; - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) (frameOffset >> 8); - this.contents[localContentsOffset++] = (byte) frameOffset; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - int numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - 4; - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapAttribute( + null, + code_length, + codeAttributeOffset, + max_locals, + true); } // update the number of attributes @@ -3055,15 +1413,14 @@ public class ClassFile implements TypeConstants, TypeIds { if (codeAttributeAttributeOffset + 2 >= this.contents.length) { resizeContents(2); } - this.contents[codeAttributeAttributeOffset++] = (byte) (attributeNumber >> 8); - this.contents[codeAttributeAttributeOffset] = (byte) attributeNumber; + this.contents[codeAttributeAttributeOffset++] = (byte) (attributesNumber >> 8); + this.contents[codeAttributeAttributeOffset] = (byte) attributesNumber; // update the attribute length - int codeAttributeLength = localContentsOffset - (codeAttributeOffset + 6); + int codeAttributeLength = this.contentsOffset - (codeAttributeOffset + 6); this.contents[codeAttributeOffset + 2] = (byte) (codeAttributeLength >> 24); this.contents[codeAttributeOffset + 3] = (byte) (codeAttributeLength >> 16); this.contents[codeAttributeOffset + 4] = (byte) (codeAttributeLength >> 8); this.contents[codeAttributeOffset + 5] = (byte) codeAttributeLength; - this.contentsOffset = localContentsOffset; } /** @@ -3077,8 +1434,8 @@ public class ClassFile implements TypeConstants, TypeIds { * - and debug attributes if necessary. */ public void completeCodeAttributeForClinit( - int codeAttributeOffset, - int problemLine) { + int codeAttributeOffset, + int problemLine) { // reinitialize the contents with the byte modified by the code stream this.contents = this.codeStream.bCodeStream; int localContentsOffset = this.codeStream.classFileOffset; @@ -3111,41 +1468,18 @@ public class ClassFile implements TypeConstants, TypeIds { // debug attributes int codeAttributeAttributeOffset = localContentsOffset; - int attributeNumber = 0; // leave two bytes for the attribute_length + int attributesNumber = 0; // leave two bytes for the attribute_length localContentsOffset += 2; // first we handle the linenumber attribute if (localContentsOffset + 2 >= this.contents.length) { resizeContents(2); } + this.contentsOffset = localContentsOffset; // first we handle the linenumber attribute if ((this.produceAttributes & ClassFileConstants.ATTR_LINES) != 0) { - if (localContentsOffset + 20 >= this.contents.length) { - resizeContents(20); - } - /* Create and add the line number attribute (used for debugging) - * Build the pairs of: - * (bytecodePC lineNumber) - * according to the table of start line indexes and the pcToSourceMap table - * contained into the codestream - */ - int lineNumberNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); - this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 6; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 1; - // first entry at pc = 0 - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (problemLine >> 8); - this.contents[localContentsOffset++] = (byte) problemLine; - // now we change the size of the line number attribute - attributeNumber++; + attributesNumber += generateLineNumberAttribute(problemLine); } + localContentsOffset = this.contentsOffset; // then we do the local variable attribute if ((this.produceAttributes & ClassFileConstants.ATTR_VARS) != 0) { int localVariableNameIndex = @@ -3161,525 +1495,27 @@ public class ClassFile implements TypeConstants, TypeIds { this.contents[localContentsOffset++] = 2; this.contents[localContentsOffset++] = 0; this.contents[localContentsOffset++] = 0; - attributeNumber++; + attributesNumber++; } - if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP_TABLE) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(null, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, true); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapTableAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapTableName); - this.contents[localContentsOffset++] = (byte) (stackMapTableAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapTableAttributeNameIndex; - - int stackMapTableAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - numberOfFrames = 0; - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - StackMapFrame prevFrame = null; - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - prevFrame = currentFrame; - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - numberOfFrames++; - int offsetDelta = currentFrame.getOffsetDelta(prevFrame); - switch (currentFrame.getFrameType(prevFrame)) { - case StackMapFrame.APPEND_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - int numberOfDifferentLocals = currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 + numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int index = currentFrame.getIndexOfDifferentLocals(numberOfDifferentLocals); - int numberOfLocals = currentFrame.getNumberOfLocals(); - for (int i = index; i < currentFrame.locals.length && numberOfDifferentLocals > 0; i++) { - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfDifferentLocals--; - } - } - break; - case StackMapFrame.SAME_FRAME : - if (localContentsOffset + 1 >= this.contents.length) { - resizeContents(1); - } - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_FRAME_EXTENDED : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - this.contents[localContentsOffset++] = (byte) 251; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.CHOP_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - numberOfDifferentLocals = -currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 - numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS : - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[localContentsOffset++] = (byte) (offsetDelta + 64); - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS_EXTENDED : - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - this.contents[localContentsOffset++] = (byte) 247; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - default : - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) 255; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - } - - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; + this.contentsOffset = localContentsOffset; - int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - 4; - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapTableAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP_TABLE) != 0) { + attributesNumber += generateStackMapTableAttribute( + null, + code_length, + codeAttributeOffset, + max_locals, + true); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(this.codeStream.methodDeclaration.binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapName); - this.contents[localContentsOffset++] = (byte) (stackMapAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapAttributeNameIndex; - - int stackMapAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int frameOffset = currentFrame.pc; - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) (frameOffset >> 8); - this.contents[localContentsOffset++] = (byte) frameOffset; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - int numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - 4; - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapAttribute( + null, + code_length, + codeAttributeOffset, + max_locals, + true); } // update the number of attributes @@ -3687,25 +1523,25 @@ public class ClassFile implements TypeConstants, TypeIds { if (codeAttributeAttributeOffset + 2 >= this.contents.length) { resizeContents(2); } - this.contents[codeAttributeAttributeOffset++] = (byte) (attributeNumber >> 8); - this.contents[codeAttributeAttributeOffset] = (byte) attributeNumber; + this.contents[codeAttributeAttributeOffset++] = (byte) (attributesNumber >> 8); + this.contents[codeAttributeAttributeOffset] = (byte) attributesNumber; // update the attribute length - int codeAttributeLength = localContentsOffset - (codeAttributeOffset + 6); + int codeAttributeLength = this.contentsOffset - (codeAttributeOffset + 6); this.contents[codeAttributeOffset + 2] = (byte) (codeAttributeLength >> 24); this.contents[codeAttributeOffset + 3] = (byte) (codeAttributeLength >> 16); this.contents[codeAttributeOffset + 4] = (byte) (codeAttributeLength >> 8); this.contents[codeAttributeOffset + 5] = (byte) codeAttributeLength; - this.contentsOffset = localContentsOffset; } + /** * */ public void completeCodeAttributeForMissingAbstractProblemMethod( - MethodBinding binding, - int codeAttributeOffset, - int[] startLineIndexes, - int problemLine) { + MethodBinding binding, + int codeAttributeOffset, + int[] startLineIndexes, + int problemLine) { // reinitialize the localContents with the byte modified by the code stream this.contents = this.codeStream.bCodeStream; int localContentsOffset = this.codeStream.classFileOffset; @@ -3729,560 +1565,36 @@ public class ClassFile implements TypeConstants, TypeIds { this.contents[localContentsOffset++] = 0; // debug attributes int codeAttributeAttributeOffset = localContentsOffset; - int attributeNumber = 0; // leave two bytes for the attribute_length + int attributesNumber = 0; // leave two bytes for the attribute_length localContentsOffset += 2; // first we handle the linenumber attribute if (localContentsOffset + 2 >= this.contents.length) { resizeContents(2); } + this.contentsOffset = localContentsOffset; if ((this.produceAttributes & ClassFileConstants.ATTR_LINES) != 0) { - if (localContentsOffset + 12 >= this.contents.length) { - resizeContents(12); - } - /* Create and add the line number attribute (used for debugging) - * Build the pairs of: - * (bytecodePC lineNumber) - * according to the table of start line indexes and the pcToSourceMap table - * contained into the codestream - */ - int lineNumberNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); - this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 6; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 1; if (problemLine == 0) { problemLine = Util.getLineNumber(binding.sourceStart(), startLineIndexes, 0, startLineIndexes.length-1); } - // first entry at pc = 0 - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (problemLine >> 8); - this.contents[localContentsOffset++] = (byte) problemLine; - // now we change the size of the line number attribute - attributeNumber++; + attributesNumber += generateLineNumberAttribute(problemLine); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP_TABLE) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapTableAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapTableName); - this.contents[localContentsOffset++] = (byte) (stackMapTableAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapTableAttributeNameIndex; - - int stackMapTableAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - numberOfFrames = 0; - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - StackMapFrame prevFrame = null; - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - prevFrame = currentFrame; - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - numberOfFrames++; - int offsetDelta = currentFrame.getOffsetDelta(prevFrame); - switch (currentFrame.getFrameType(prevFrame)) { - case StackMapFrame.APPEND_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - int numberOfDifferentLocals = currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 + numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int index = currentFrame.getIndexOfDifferentLocals(numberOfDifferentLocals); - int numberOfLocals = currentFrame.getNumberOfLocals(); - for (int i = index; i < currentFrame.locals.length && numberOfDifferentLocals > 0; i++) { - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfDifferentLocals--; - } - } - break; - case StackMapFrame.SAME_FRAME : - if (localContentsOffset + 1 >= this.contents.length) { - resizeContents(1); - } - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_FRAME_EXTENDED : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - this.contents[localContentsOffset++] = (byte) 251; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.CHOP_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - numberOfDifferentLocals = -currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 - numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS : - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[localContentsOffset++] = (byte) (offsetDelta + 64); - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS_EXTENDED : - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - this.contents[localContentsOffset++] = (byte) 247; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - default : - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) 255; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - } - - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - 4; - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapTableAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapTableAttribute( + binding, + code_length, + codeAttributeOffset, + max_locals, + false); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(this.codeStream.methodDeclaration.binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapName); - this.contents[localContentsOffset++] = (byte) (stackMapAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapAttributeNameIndex; - - int stackMapAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int frameOffset = currentFrame.pc; - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) (frameOffset >> 8); - this.contents[localContentsOffset++] = (byte) frameOffset; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - int numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - 4; - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapAttribute( + binding, + code_length, + codeAttributeOffset, + max_locals, + false); } // then we do the local variable attribute @@ -4290,15 +1602,14 @@ public class ClassFile implements TypeConstants, TypeIds { if (codeAttributeAttributeOffset + 2 >= this.contents.length) { resizeContents(2); } - this.contents[codeAttributeAttributeOffset++] = (byte) (attributeNumber >> 8); - this.contents[codeAttributeAttributeOffset] = (byte) attributeNumber; + this.contents[codeAttributeAttributeOffset++] = (byte) (attributesNumber >> 8); + this.contents[codeAttributeAttributeOffset] = (byte) attributesNumber; // update the attribute length - int codeAttributeLength = localContentsOffset - (codeAttributeOffset + 6); + int codeAttributeLength = this.contentsOffset - (codeAttributeOffset + 6); this.contents[codeAttributeOffset + 2] = (byte) (codeAttributeLength >> 24); this.contents[codeAttributeOffset + 3] = (byte) (codeAttributeLength >> 16); this.contents[codeAttributeOffset + 4] = (byte) (codeAttributeLength >> 8); this.contents[codeAttributeOffset + 5] = (byte) codeAttributeLength; - this.contentsOffset = localContentsOffset; } /** @@ -4313,7 +1624,12 @@ public class ClassFile implements TypeConstants, TypeIds { * * @param codeAttributeOffset <CODE>int</CODE> */ - public void completeCodeAttributeForProblemMethod(AbstractMethodDeclaration method, MethodBinding binding, int codeAttributeOffset, int[] startLineIndexes, int problemLine) { + public void completeCodeAttributeForProblemMethod( + AbstractMethodDeclaration method, + MethodBinding binding, + int codeAttributeOffset, + int[] startLineIndexes, + int problemLine) { // reinitialize the localContents with the byte modified by the code stream this.contents = this.codeStream.bCodeStream; int localContentsOffset = this.codeStream.classFileOffset; @@ -4339,800 +1655,56 @@ public class ClassFile implements TypeConstants, TypeIds { this.contents[localContentsOffset++] = 0; // debug attributes int codeAttributeAttributeOffset = localContentsOffset; - int attributeNumber = 0; // leave two bytes for the attribute_length + int attributesNumber = 0; // leave two bytes for the attribute_length localContentsOffset += 2; // first we handle the linenumber attribute if (localContentsOffset + 2 >= this.contents.length) { resizeContents(2); } + this.contentsOffset = localContentsOffset; if ((this.produceAttributes & ClassFileConstants.ATTR_LINES) != 0) { - if (localContentsOffset + 20 >= this.contents.length) { - resizeContents(20); - } - /* Create and add the line number attribute (used for debugging) - * Build the pairs of: - * (bytecodePC lineNumber) - * according to the table of start line indexes and the pcToSourceMap table - * contained into the codestream - */ - int lineNumberNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); - this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 6; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 1; if (problemLine == 0) { problemLine = Util.getLineNumber(binding.sourceStart(), startLineIndexes, 0, startLineIndexes.length-1); } - // first entry at pc = 0 - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (problemLine >> 8); - this.contents[localContentsOffset++] = (byte) problemLine; - // now we change the size of the line number attribute - attributeNumber++; + attributesNumber += generateLineNumberAttribute(problemLine); } + // then we do the local variable attribute if ((this.produceAttributes & ClassFileConstants.ATTR_VARS) != 0) { - // compute the resolved position for the arguments of the method - int argSize; - int numberOfEntries = 0; - // codeAttribute.addLocalVariableTableAttribute(this); - int localVariableNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTableName); - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - this.contents[localContentsOffset++] = (byte) (localVariableNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableNameIndex; - int localVariableTableOffset = localContentsOffset; - localContentsOffset += 6; - // leave space for attribute_length and local_variable_table_length - int descriptorIndex; - int nameIndex; - SourceTypeBinding declaringClassBinding = null; final boolean methodDeclarationIsStatic = this.codeStream.methodDeclaration.isStatic(); - if (!methodDeclarationIsStatic) { - numberOfEntries++; - if (localContentsOffset + 10 >= this.contents.length) { - resizeContents(10); - } - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = this.constantPool.literalIndex(ConstantPool.This); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - declaringClassBinding = (SourceTypeBinding) this.codeStream.methodDeclaration.binding.declaringClass; - descriptorIndex = - this.constantPool.literalIndex(declaringClassBinding.signature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - // the resolved position for this is always 0 - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - } - // used to remember the local variable with a generic type - int genericLocalVariablesCounter = 0; - LocalVariableBinding[] genericLocalVariables = null; - int numberOfGenericEntries = 0; - - if (binding.isConstructor()) { - ReferenceBinding declaringClass = binding.declaringClass; - if (declaringClass.isNestedType()) { - NestedTypeBinding methodDeclaringClass = (NestedTypeBinding) declaringClass; - argSize = methodDeclaringClass.getEnclosingInstancesSlotSize(); - SyntheticArgumentBinding[] syntheticArguments; - if ((syntheticArguments = methodDeclaringClass.syntheticEnclosingInstances()) != null) { - for (int i = 0, max = syntheticArguments.length; i < max; i++) { - LocalVariableBinding localVariable = syntheticArguments[i]; - final TypeBinding localVariableTypeBinding = localVariable.type; - if (localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable()) { - if (genericLocalVariables == null) { - // we cannot have more than max locals - genericLocalVariables = new LocalVariableBinding[max]; - } - genericLocalVariables[genericLocalVariablesCounter++] = localVariable; - numberOfGenericEntries++; - } - if (localContentsOffset + 10 >= this.contents.length) { - resizeContents(10); - } - // now we can safely add the local entry - numberOfEntries++; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariableTypeBinding.signature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } else { - argSize = 1; - } - } else { - argSize = binding.isStatic() ? 0 : 1; - } - - int genericArgumentsCounter = 0; - int[] genericArgumentsNameIndexes = null; - int[] genericArgumentsResolvedPositions = null; - TypeBinding[] genericArgumentsTypeBindings = null; - - if (method.binding != null) { - TypeBinding[] parameters = method.binding.parameters; - Argument[] arguments = method.arguments; - if ((parameters != null) && (arguments != null)) { - for (int i = 0, max = parameters.length; i < max; i++) { - TypeBinding argumentBinding = parameters[i]; - if (localContentsOffset + 10 >= this.contents.length) { - resizeContents(10); - } - // now we can safely add the local entry - numberOfEntries++; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = this.constantPool.literalIndex(arguments[i].name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - int resolvedPosition = argSize; - if (argumentBinding.isParameterizedType() || argumentBinding.isTypeVariable()) { - if (genericArgumentsCounter == 0) { - // we cannot have more than max locals - genericArgumentsNameIndexes = new int[max]; - genericArgumentsResolvedPositions = new int[max]; - genericArgumentsTypeBindings = new TypeBinding[max]; - } - genericArgumentsNameIndexes[genericArgumentsCounter] = nameIndex; - genericArgumentsResolvedPositions[genericArgumentsCounter] = resolvedPosition; - genericArgumentsTypeBindings[genericArgumentsCounter++] = argumentBinding; - } - descriptorIndex = this.constantPool.literalIndex(argumentBinding.signature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - switch(argumentBinding.id) { - case TypeIds.T_long : - case TypeIds.T_double : - argSize += 2; - break; - default : - argSize++; - break; - } - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } - int value = numberOfEntries * 10 + 2; - this.contents[localVariableTableOffset++] = (byte) (value >> 24); - this.contents[localVariableTableOffset++] = (byte) (value >> 16); - this.contents[localVariableTableOffset++] = (byte) (value >> 8); - this.contents[localVariableTableOffset++] = (byte) value; - this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8); - this.contents[localVariableTableOffset] = (byte) numberOfEntries; - attributeNumber++; - - final boolean currentInstanceIsGeneric = - !methodDeclarationIsStatic - && declaringClassBinding != null - && declaringClassBinding.typeVariables != Binding.NO_TYPE_VARIABLES; - if (genericLocalVariablesCounter != 0 || genericArgumentsCounter != 0 || currentInstanceIsGeneric) { - // add the local variable type table attribute - numberOfEntries = numberOfGenericEntries + genericArgumentsCounter + (currentInstanceIsGeneric ? 1 : 0); - // reserve enough space - int maxOfEntries = 8 + numberOfEntries * 10; - if (localContentsOffset + maxOfEntries >= this.contents.length) { - resizeContents(maxOfEntries); - } - int localVariableTypeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName); - this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex; - value = numberOfEntries * 10 + 2; - this.contents[localContentsOffset++] = (byte) (value >> 24); - this.contents[localContentsOffset++] = (byte) (value >> 16); - this.contents[localContentsOffset++] = (byte) (value >> 8); - this.contents[localContentsOffset++] = (byte) value; - this.contents[localContentsOffset++] = (byte) (numberOfEntries >> 8); - this.contents[localContentsOffset++] = (byte) numberOfEntries; - if (currentInstanceIsGeneric) { - numberOfEntries++; - this.contents[localContentsOffset++] = 0; // the startPC for this is always 0 - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = this.constantPool.literalIndex(ConstantPool.This); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(declaringClassBinding.genericTypeSignature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0 - this.contents[localContentsOffset++] = 0; - } - - for (int i = 0; i < genericLocalVariablesCounter; i++) { - LocalVariableBinding localVariable = genericLocalVariables[i]; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariable.type.genericTypeSignature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - for (int i = 0; i < genericArgumentsCounter; i++) { - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (code_length >> 8); - this.contents[localContentsOffset++] = (byte) code_length; - nameIndex = genericArgumentsNameIndexes[i]; - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(genericArgumentsTypeBindings[i].genericTypeSignature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = genericArgumentsResolvedPositions[i]; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - attributeNumber++; - } + attributesNumber += generateLocalVariableTableAttribute(code_length, methodDeclarationIsStatic, false); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP_TABLE) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapTableAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapTableName); - this.contents[localContentsOffset++] = (byte) (stackMapTableAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapTableAttributeNameIndex; - - int stackMapTableAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - numberOfFrames = 0; - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - StackMapFrame prevFrame = null; - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - prevFrame = currentFrame; - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - numberOfFrames++; - int offsetDelta = currentFrame.getOffsetDelta(prevFrame); - switch (currentFrame.getFrameType(prevFrame)) { - case StackMapFrame.APPEND_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - int numberOfDifferentLocals = currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 + numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int index = currentFrame.getIndexOfDifferentLocals(numberOfDifferentLocals); - int numberOfLocals = currentFrame.getNumberOfLocals(); - for (int i = index; i < currentFrame.locals.length && numberOfDifferentLocals > 0; i++) { - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfDifferentLocals--; - } - } - break; - case StackMapFrame.SAME_FRAME : - if (localContentsOffset + 1 >= this.contents.length) { - resizeContents(1); - } - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_FRAME_EXTENDED : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - this.contents[localContentsOffset++] = (byte) 251; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.CHOP_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - numberOfDifferentLocals = -currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 - numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS : - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[localContentsOffset++] = (byte) (offsetDelta + 64); - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS_EXTENDED : - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - this.contents[localContentsOffset++] = (byte) 247; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - default : - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) 255; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - } - - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - 4; - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapTableAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapTableAttribute( + binding, + code_length, + codeAttributeOffset, + max_locals, + false); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(this.codeStream.methodDeclaration.binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapName); - this.contents[localContentsOffset++] = (byte) (stackMapAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapAttributeNameIndex; - - int stackMapAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int frameOffset = currentFrame.pc; - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) (frameOffset >> 8); - this.contents[localContentsOffset++] = (byte) frameOffset; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - int numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - 4; - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapAttribute( + binding, + code_length, + codeAttributeOffset, + max_locals, + false); } // update the number of attributes// ensure first that there is enough space available inside the localContents array if (codeAttributeAttributeOffset + 2 >= this.contents.length) { resizeContents(2); } - this.contents[codeAttributeAttributeOffset++] = (byte) (attributeNumber >> 8); - this.contents[codeAttributeAttributeOffset] = (byte) attributeNumber; + this.contents[codeAttributeAttributeOffset++] = (byte) (attributesNumber >> 8); + this.contents[codeAttributeAttributeOffset] = (byte) attributesNumber; // update the attribute length - int codeAttributeLength = localContentsOffset - (codeAttributeOffset + 6); + int codeAttributeLength = this.contentsOffset - (codeAttributeOffset + 6); this.contents[codeAttributeOffset + 2] = (byte) (codeAttributeLength >> 24); this.contents[codeAttributeOffset + 3] = (byte) (codeAttributeLength >> 16); this.contents[codeAttributeOffset + 4] = (byte) (codeAttributeLength >> 8); this.contents[codeAttributeOffset + 5] = (byte) codeAttributeLength; - this.contentsOffset = localContentsOffset; } /** @@ -5149,10 +1721,10 @@ public class ClassFile implements TypeConstants, TypeIds { * @param codeAttributeOffset <CODE>int</CODE> */ public void completeCodeAttributeForSyntheticMethod( - boolean hasExceptionHandlers, - SyntheticMethodBinding binding, - int codeAttributeOffset, - int[] startLineIndexes) { + boolean hasExceptionHandlers, + SyntheticMethodBinding binding, + int codeAttributeOffset, + int[] startLineIndexes) { // reinitialize the contents with the byte modified by the code stream this.contents = this.codeStream.bCodeStream; int localContentsOffset = this.codeStream.classFileOffset; @@ -5211,7 +1783,6 @@ public class ClassFile implements TypeConstants, TypeIds { if (addStackMaps) { StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; stackMapFrameCodeStream.addFramePosition(handlerPC); -// stackMapFrameCodeStream.addExceptionMarker(handlerPC, exceptionLabel.exceptionType); } this.contents[localContentsOffset++] = (byte) (handlerPC >> 8); this.contents[localContentsOffset++] = (byte) handlerPC; @@ -5247,679 +1818,35 @@ public class ClassFile implements TypeConstants, TypeIds { } // debug attributes int codeAttributeAttributeOffset = localContentsOffset; - int attributeNumber = 0; + int attributesNumber = 0; // leave two bytes for the attribute_length localContentsOffset += 2; if (localContentsOffset + 2 >= this.contents.length) { resizeContents(2); } + this.contentsOffset = localContentsOffset; // first we handle the linenumber attribute if ((this.produceAttributes & ClassFileConstants.ATTR_LINES) != 0) { - if (localContentsOffset + 12 >= this.contents.length) { - resizeContents(12); - } - int index = 0; - int lineNumberNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); - this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; - int lineNumberTableOffset = localContentsOffset; - localContentsOffset += 6; - // leave space for attribute_length and line_number_table_length - // Seems like do would be better, but this preserves the existing behavior. - index = Util.getLineNumber(binding.sourceStart, startLineIndexes, 0, startLineIndexes.length-1); - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = 0; - this.contents[localContentsOffset++] = (byte) (index >> 8); - this.contents[localContentsOffset++] = (byte) index; - // now we change the size of the line number attribute - this.contents[lineNumberTableOffset++] = 0; - this.contents[lineNumberTableOffset++] = 0; - this.contents[lineNumberTableOffset++] = 0; - this.contents[lineNumberTableOffset++] = 6; - this.contents[lineNumberTableOffset++] = 0; - this.contents[lineNumberTableOffset++] = 1; - attributeNumber++; + int lineNumber = Util.getLineNumber(binding.sourceStart, startLineIndexes, 0, startLineIndexes.length-1); + attributesNumber += generateLineNumberAttribute(lineNumber); } // then we do the local variable attribute if ((this.produceAttributes & ClassFileConstants.ATTR_VARS) != 0) { - int numberOfEntries = 0; - int localVariableNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTableName); - if (localContentsOffset + 8 > this.contents.length) { - resizeContents(8); - } - this.contents[localContentsOffset++] = (byte) (localVariableNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableNameIndex; - int localVariableTableOffset = localContentsOffset; - localContentsOffset += 6; - // leave space for attribute_length and local_variable_table_length - int nameIndex; - int descriptorIndex; - - // used to remember the local variable with a generic type - int genericLocalVariablesCounter = 0; - LocalVariableBinding[] genericLocalVariables = null; - int numberOfGenericEntries = 0; - - for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) { - LocalVariableBinding localVariable = this.codeStream.locals[i]; - if (localVariable.declaration == null) continue; - final TypeBinding localVariableTypeBinding = localVariable.type; - boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable(); - if (localVariable.initializationCount != 0 && isParameterizedType) { - if (genericLocalVariables == null) { - // we cannot have more than max locals - genericLocalVariables = new LocalVariableBinding[max]; - } - genericLocalVariables[genericLocalVariablesCounter++] = localVariable; - } - for (int j = 0; j < localVariable.initializationCount; j++) { - int startPC = localVariable.initializationPCs[j << 1]; - int endPC = localVariable.initializationPCs[(j << 1) + 1]; - if (startPC != endPC) { // only entries for non zero length - if (endPC == -1) { - localVariable.declaringScope.problemReporter().abortDueToInternalError( - Messages.bind(Messages.abort_invalidAttribute, new String(localVariable.name)), - (ASTNode) localVariable.declaringScope.methodScope().referenceContext); - } - if (localContentsOffset + 10 > this.contents.length) { - resizeContents(10); - } - // now we can safely add the local entry - numberOfEntries++; - if (isParameterizedType) { - numberOfGenericEntries++; - } - this.contents[localContentsOffset++] = (byte) (startPC >> 8); - this.contents[localContentsOffset++] = (byte) startPC; - int length = endPC - startPC; - this.contents[localContentsOffset++] = (byte) (length >> 8); - this.contents[localContentsOffset++] = (byte) length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariableTypeBinding.signature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } - int value = numberOfEntries * 10 + 2; - this.contents[localVariableTableOffset++] = (byte) (value >> 24); - this.contents[localVariableTableOffset++] = (byte) (value >> 16); - this.contents[localVariableTableOffset++] = (byte) (value >> 8); - this.contents[localVariableTableOffset++] = (byte) value; - this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8); - this.contents[localVariableTableOffset] = (byte) numberOfEntries; - attributeNumber++; - - if (genericLocalVariablesCounter != 0) { - // add the local variable type table attribute - int maxOfEntries = 8 + numberOfGenericEntries * 10; - // reserve enough space - if (localContentsOffset + maxOfEntries >= this.contents.length) { - resizeContents(maxOfEntries); - } - int localVariableTypeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName); - this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex; - value = numberOfGenericEntries * 10 + 2; - this.contents[localContentsOffset++] = (byte) (value >> 24); - this.contents[localContentsOffset++] = (byte) (value >> 16); - this.contents[localContentsOffset++] = (byte) (value >> 8); - this.contents[localContentsOffset++] = (byte) value; - this.contents[localContentsOffset++] = (byte) (numberOfGenericEntries >> 8); - this.contents[localContentsOffset++] = (byte) numberOfGenericEntries; - - for (int i = 0; i < genericLocalVariablesCounter; i++) { - LocalVariableBinding localVariable = genericLocalVariables[i]; - for (int j = 0; j < localVariable.initializationCount; j++) { - int startPC = localVariable.initializationPCs[j << 1]; - int endPC = localVariable.initializationPCs[(j << 1) + 1]; - if (startPC != endPC) { // only entries for non zero length - // now we can safely add the local entry - this.contents[localContentsOffset++] = (byte) (startPC >> 8); - this.contents[localContentsOffset++] = (byte) startPC; - int length = endPC - startPC; - this.contents[localContentsOffset++] = (byte) (length >> 8); - this.contents[localContentsOffset++] = (byte) length; - nameIndex = this.constantPool.literalIndex(localVariable.name); - this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); - this.contents[localContentsOffset++] = (byte) nameIndex; - descriptorIndex = this.constantPool.literalIndex(localVariable.type.genericTypeSignature()); - this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); - this.contents[localContentsOffset++] = (byte) descriptorIndex; - int resolvedPosition = localVariable.resolvedPosition; - this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); - this.contents[localContentsOffset++] = (byte) resolvedPosition; - } - } - } - attributeNumber++; - } + final boolean methodDeclarationIsStatic = binding.isStatic(); + attributesNumber += generateLocalVariableTableAttribute(code_length, methodDeclarationIsStatic, true); } - if (addStackMaps) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapTableAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapTableName); - this.contents[localContentsOffset++] = (byte) (stackMapTableAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapTableAttributeNameIndex; - - int stackMapTableAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - StackMapFrame prevFrame = null; - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - prevFrame = currentFrame; - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int offsetDelta = currentFrame.getOffsetDelta(prevFrame); - switch (currentFrame.getFrameType(prevFrame)) { - case StackMapFrame.APPEND_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - int numberOfDifferentLocals = currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 + numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int index = currentFrame.getIndexOfDifferentLocals(numberOfDifferentLocals); - int numberOfLocals = currentFrame.getNumberOfLocals(); - for (int i = index; i < currentFrame.locals.length && numberOfDifferentLocals > 0; i++) { - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfDifferentLocals--; - } - } - break; - case StackMapFrame.SAME_FRAME : - if (localContentsOffset + 1 >= this.contents.length) { - resizeContents(1); - } - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_FRAME_EXTENDED : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - this.contents[localContentsOffset++] = (byte) 251; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.CHOP_FRAME : - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - numberOfDifferentLocals = -currentFrame.numberOfDifferentLocals(prevFrame); - this.contents[localContentsOffset++] = (byte) (251 - numberOfDifferentLocals); - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS : - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[localContentsOffset++] = (byte) (offsetDelta + 64); - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS_EXTENDED : - if (localContentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - this.contents[localContentsOffset++] = (byte) 247; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - if (currentFrame.stackItems[0] == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(currentFrame.stackItems[0].id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - VerificationTypeInfo info = currentFrame.stackItems[0]; - byte tag = (byte) info.tag; - this.contents[localContentsOffset++] = tag; - switch (tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - break; - default : - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) 255; - this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); - this.contents[localContentsOffset++] = (byte) offsetDelta; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - 4; - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapTableAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapTableAttribute(binding, code_length, codeAttributeOffset, max_locals, false); } if ((this.produceAttributes & ClassFileConstants.ATTR_STACK_MAP) != 0) { - StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; - stackMapFrameCodeStream.removeFramePosition(code_length); - if (stackMapFrameCodeStream.hasFramePositions()) { - ArrayList frames = new ArrayList(); - traverse(this.codeStream.methodDeclaration.binding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, false); - int numberOfFrames = frames.size(); - if (numberOfFrames > 1) { - int stackMapTableAttributeOffset = localContentsOffset; - // add the stack map table attribute - if (localContentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int stackMapAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.StackMapName); - this.contents[localContentsOffset++] = (byte) (stackMapAttributeNameIndex >> 8); - this.contents[localContentsOffset++] = (byte) stackMapAttributeNameIndex; - - int stackMapAttributeLengthOffset = localContentsOffset; - // generate the attribute - localContentsOffset += 4; - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - int numberOfFramesOffset = localContentsOffset; - localContentsOffset += 2; - if (localContentsOffset + 2 >= this.contents.length) { - resizeContents(2); - } - StackMapFrame currentFrame = (StackMapFrame) frames.get(0); - for (int j = 1; j < numberOfFrames; j++) { - // select next frame - currentFrame = (StackMapFrame) frames.get(j); - // generate current frame - // need to find differences between the current frame and the previous frame - int frameOffset = currentFrame.pc; - // FULL_FRAME - if (localContentsOffset + 5 >= this.contents.length) { - resizeContents(5); - } - this.contents[localContentsOffset++] = (byte) (frameOffset >> 8); - this.contents[localContentsOffset++] = (byte) frameOffset; - int numberOfLocalOffset = localContentsOffset; - localContentsOffset += 2; // leave two spots for number of locals - int numberOfLocalEntries = 0; - int numberOfLocals = currentFrame.getNumberOfLocals(); - int numberOfEntries = 0; - int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; - for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.locals[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - i++; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - i++; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - numberOfLocalEntries++; - } - numberOfEntries++; - } - if (localContentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); - this.contents[numberOfLocalOffset] = (byte) numberOfEntries; - int numberOfStackItems = currentFrame.numberOfStackItems; - this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); - this.contents[localContentsOffset++] = (byte) numberOfStackItems; - for (int i = 0; i < numberOfStackItems; i++) { - if (localContentsOffset + 3 >= this.contents.length) { - resizeContents(3); - } - VerificationTypeInfo info = currentFrame.stackItems[i]; - if (info == null) { - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; - } else { - switch(info.id()) { - case T_boolean : - case T_byte : - case T_char : - case T_int : - case T_short : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; - break; - case T_float : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; - break; - case T_long : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; - break; - case T_double : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; - break; - case T_null : - this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; - break; - default: - this.contents[localContentsOffset++] = (byte) info.tag; - switch (info.tag) { - case VerificationTypeInfo.ITEM_UNINITIALIZED : - int offset = info.offset; - this.contents[localContentsOffset++] = (byte) (offset >> 8); - this.contents[localContentsOffset++] = (byte) offset; - break; - case VerificationTypeInfo.ITEM_OBJECT : - int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); - this.contents[localContentsOffset++] = (byte) (indexForType >> 8); - this.contents[localContentsOffset++] = (byte) indexForType; - } - } - } - } - } - - numberOfFrames--; - if (numberOfFrames != 0) { - this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); - this.contents[numberOfFramesOffset] = (byte) numberOfFrames; - - int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - 4; - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[stackMapAttributeLengthOffset] = (byte) attributeLength; - attributeNumber++; - } else { - localContentsOffset = stackMapTableAttributeOffset; - } - } - } + attributesNumber += generateStackMapAttribute( + binding, + code_length, + codeAttributeOffset, + max_locals, + false); } // update the number of attributes @@ -5927,16 +1854,14 @@ public class ClassFile implements TypeConstants, TypeIds { if (codeAttributeAttributeOffset + 2 >= this.contents.length) { resizeContents(2); } - this.contents[codeAttributeAttributeOffset++] = (byte) (attributeNumber >> 8); - this.contents[codeAttributeAttributeOffset] = (byte) attributeNumber; - + this.contents[codeAttributeAttributeOffset++] = (byte) (attributesNumber >> 8); + this.contents[codeAttributeAttributeOffset] = (byte) attributesNumber; // update the attribute length - int codeAttributeLength = localContentsOffset - (codeAttributeOffset + 6); + int codeAttributeLength = this.contentsOffset - (codeAttributeOffset + 6); this.contents[codeAttributeOffset + 2] = (byte) (codeAttributeLength >> 24); this.contents[codeAttributeOffset + 3] = (byte) (codeAttributeLength >> 16); this.contents[codeAttributeOffset + 4] = (byte) (codeAttributeLength >> 8); this.contents[codeAttributeOffset + 5] = (byte) codeAttributeLength; - this.contentsOffset = localContentsOffset; } /** @@ -5953,9 +1878,9 @@ public class ClassFile implements TypeConstants, TypeIds { * @param codeAttributeOffset <CODE>int</CODE> */ public void completeCodeAttributeForSyntheticMethod( - SyntheticMethodBinding binding, - int codeAttributeOffset, - int[] startLineIndexes) { + SyntheticMethodBinding binding, + int codeAttributeOffset, + int[] startLineIndexes) { this.completeCodeAttributeForSyntheticMethod( false, @@ -5969,16 +1894,16 @@ public class ClassFile implements TypeConstants, TypeIds { * Complete the creation of a method info by setting up the number of attributes at the right offset. * * @param methodAttributeOffset <CODE>int</CODE> - * @param attributeNumber <CODE>int</CODE> + * @param attributesNumber <CODE>int</CODE> */ public void completeMethodInfo( - int methodAttributeOffset, - int attributeNumber) { + MethodBinding binding, + int methodAttributeOffset, + int attributesNumber) { // update the number of attributes - this.contents[methodAttributeOffset++] = (byte) (attributeNumber >> 8); - this.contents[methodAttributeOffset] = (byte) attributeNumber; + this.contents[methodAttributeOffset++] = (byte) (attributesNumber >> 8); + this.contents[methodAttributeOffset] = (byte) attributesNumber; } - /** * INTERNAL USE-ONLY * This methods returns a char[] representing the file name of the receiver @@ -6064,6 +1989,29 @@ public class ClassFile implements TypeConstants, TypeIds { } } + private int generateAnnotationDefaultAttribute(AnnotationMethodDeclaration declaration, int attributeOffset) { + int attributesNumber = 0; + // add an annotation default attribute + int annotationDefaultNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.AnnotationDefaultName); + if (this.contentsOffset + 6 >= this.contents.length) { + resizeContents(6); + } + this.contents[this.contentsOffset++] = (byte) (annotationDefaultNameIndex >> 8); + this.contents[this.contentsOffset++] = (byte) annotationDefaultNameIndex; + int attributeLengthOffset = this.contentsOffset; + this.contentsOffset += 4; + generateElementValue(declaration.defaultValue, declaration.binding.returnType, attributeOffset); + if (this.contentsOffset != attributeOffset) { + int attributeLength = this.contentsOffset - attributeLengthOffset - 4; + this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); + this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); + this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8); + this.contents[attributeLengthOffset++] = (byte) attributeLength; + attributesNumber++; + } + return attributesNumber; + } /** * INTERNAL USE-ONLY * That method generates the header of a code attribute. @@ -6081,7 +2029,104 @@ public class ClassFile implements TypeConstants, TypeIds { // leave space for attribute_length(4), max_stack(2), max_locals(2), code_length(4) this.contentsOffset += 12; } - + + private int generateConstantValueAttribute(Constant fieldConstant, FieldBinding fieldBinding, int fieldAttributeOffset) { + int localContentsOffset = this.contentsOffset; + int attributesNumber = 1; + if (localContentsOffset + 8 >= this.contents.length) { + resizeContents(8); + } + // Now we generate the constant attribute corresponding to the fieldBinding + int constantValueNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.ConstantValueName); + this.contents[localContentsOffset++] = (byte) (constantValueNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) constantValueNameIndex; + // The attribute length = 2 in case of a constantValue attribute + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 2; + // Need to add the constant_value_index + switch (fieldConstant.typeID()) { + case T_boolean : + int booleanValueIndex = + this.constantPool.literalIndex(fieldConstant.booleanValue() ? 1 : 0); + this.contents[localContentsOffset++] = (byte) (booleanValueIndex >> 8); + this.contents[localContentsOffset++] = (byte) booleanValueIndex; + break; + case T_byte : + case T_char : + case T_int : + case T_short : + int integerValueIndex = + this.constantPool.literalIndex(fieldConstant.intValue()); + this.contents[localContentsOffset++] = (byte) (integerValueIndex >> 8); + this.contents[localContentsOffset++] = (byte) integerValueIndex; + break; + case T_float : + int floatValueIndex = + this.constantPool.literalIndex(fieldConstant.floatValue()); + this.contents[localContentsOffset++] = (byte) (floatValueIndex >> 8); + this.contents[localContentsOffset++] = (byte) floatValueIndex; + break; + case T_double : + int doubleValueIndex = + this.constantPool.literalIndex(fieldConstant.doubleValue()); + this.contents[localContentsOffset++] = (byte) (doubleValueIndex >> 8); + this.contents[localContentsOffset++] = (byte) doubleValueIndex; + break; + case T_long : + int longValueIndex = + this.constantPool.literalIndex(fieldConstant.longValue()); + this.contents[localContentsOffset++] = (byte) (longValueIndex >> 8); + this.contents[localContentsOffset++] = (byte) longValueIndex; + break; + case T_JavaLangString : + int stringValueIndex = + this.constantPool.literalIndex( + ((StringConstant) fieldConstant).stringValue()); + if (stringValueIndex == -1) { + if (!this.creatingProblemType) { + // report an error and abort: will lead to a problem type classfile creation + TypeDeclaration typeDeclaration = this.referenceBinding.scope.referenceContext; + FieldDeclaration[] fieldDecls = typeDeclaration.fields; + for (int i = 0, max = fieldDecls.length; i < max; i++) { + if (fieldDecls[i].binding == fieldBinding) { + // problem should abort + typeDeclaration.scope.problemReporter().stringConstantIsExceedingUtf8Limit( + fieldDecls[i]); + } + } + } else { + // already inside a problem type creation : no constant for this field + this.contentsOffset = fieldAttributeOffset; + attributesNumber = 0; + } + } else { + this.contents[localContentsOffset++] = (byte) (stringValueIndex >> 8); + this.contents[localContentsOffset++] = (byte) stringValueIndex; + } + } + this.contentsOffset = localContentsOffset; + return attributesNumber; + } + private int generateDeprecatedAttribute() { + int localContentsOffset = this.contentsOffset; + if (localContentsOffset + 6 >= this.contents.length) { + resizeContents(6); + } + int deprecatedAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.DeprecatedName); + this.contents[localContentsOffset++] = (byte) (deprecatedAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) deprecatedAttributeNameIndex; + // the length of a deprecated attribute is equals to 0 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contentsOffset = localContentsOffset; + return 1; + } private void generateElementValue( Expression defaultValue, TypeBinding memberValuePairReturnType, @@ -6107,7 +2152,6 @@ public class ClassFile implements TypeConstants, TypeIds { } } } - /** * @param attributeOffset */ @@ -6191,7 +2235,7 @@ public class ClassFile implements TypeConstants, TypeIds { } } } - + private void generateElementValueForNonConstantExpression(Expression defaultValue, int attributeOffset, TypeBinding defaultValueBinding) { if (defaultValueBinding != null) { if (defaultValueBinding.isEnum()) { @@ -6260,6 +2304,413 @@ public class ClassFile implements TypeConstants, TypeIds { } } + private int generateEnclosingMethodAttribute() { + int localContentsOffset = this.contentsOffset; + // add enclosing method attribute (1.5 mode only) + if (localContentsOffset + 10 >= this.contents.length) { + resizeContents(10); + } + int enclosingMethodAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.EnclosingMethodName); + this.contents[localContentsOffset++] = (byte) (enclosingMethodAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) enclosingMethodAttributeNameIndex; + // the length of a signature attribute is equals to 2 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 4; + + int enclosingTypeIndex = this.constantPool.literalIndexForType(this.referenceBinding.enclosingType().constantPoolName()); + this.contents[localContentsOffset++] = (byte) (enclosingTypeIndex >> 8); + this.contents[localContentsOffset++] = (byte) enclosingTypeIndex; + byte methodIndexByte1 = 0; + byte methodIndexByte2 = 0; + if (this.referenceBinding instanceof LocalTypeBinding) { + MethodBinding methodBinding = ((LocalTypeBinding) this.referenceBinding).enclosingMethod; + if (methodBinding != null) { +//{ObjectTeams: static role methods need to know the constant pool declaring class: +/* orig: + int enclosingMethodIndex = this.constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature(this)); + :giro */ + int enclosingMethodIndex = this.constantPool.literalIndexForNameAndType(methodBinding.selector, methodBinding.signature(this, this.referenceBinding)); +// SH} + methodIndexByte1 = (byte) (enclosingMethodIndex >> 8); + methodIndexByte2 = (byte) enclosingMethodIndex; + } + } + this.contents[localContentsOffset++] = methodIndexByte1; + this.contents[localContentsOffset++] = methodIndexByte2; + this.contentsOffset = localContentsOffset; + return 1; + } + private int generateExceptionsAttribute(ReferenceBinding[] thrownsExceptions) { + int localContentsOffset = this.contentsOffset; + int length = thrownsExceptions.length; + int exSize = 8 + length * 2; + if (exSize + this.contentsOffset >= this.contents.length) { + resizeContents(exSize); + } + int exceptionNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.ExceptionsName); + this.contents[localContentsOffset++] = (byte) (exceptionNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) exceptionNameIndex; + // The attribute length = length * 2 + 2 in case of a exception attribute + int attributeLength = length * 2 + 2; + this.contents[localContentsOffset++] = (byte) (attributeLength >> 24); + this.contents[localContentsOffset++] = (byte) (attributeLength >> 16); + this.contents[localContentsOffset++] = (byte) (attributeLength >> 8); + this.contents[localContentsOffset++] = (byte) attributeLength; + this.contents[localContentsOffset++] = (byte) (length >> 8); + this.contents[localContentsOffset++] = (byte) length; + for (int i = 0; i < length; i++) { + int exceptionIndex = this.constantPool.literalIndexForType(thrownsExceptions[i]); + this.contents[localContentsOffset++] = (byte) (exceptionIndex >> 8); + this.contents[localContentsOffset++] = (byte) exceptionIndex; + } + this.contentsOffset = localContentsOffset; + return 1; + } + private int generateHierarchyInconsistentAttribute() { + int localContentsOffset = this.contentsOffset; + // add an attribute for inconsistent hierarchy + if (localContentsOffset + 6 >= this.contents.length) { + resizeContents(6); + } + int inconsistentHierarchyNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.InconsistentHierarchy); + this.contents[localContentsOffset++] = (byte) (inconsistentHierarchyNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) inconsistentHierarchyNameIndex; + // the length of an inconsistent hierarchy attribute is equals to 0 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contentsOffset = localContentsOffset; + return 1; + } + private int generateInnerClassAttribute(int numberOfInnerClasses, ReferenceBinding[] innerClasses) { + int localContentsOffset = this.contentsOffset; + // Generate the inner class attribute + int exSize = 8 * numberOfInnerClasses + 8; + if (exSize + localContentsOffset >= this.contents.length) { + resizeContents(exSize); + } + // Now we now the size of the attribute and the number of entries + // attribute name + int attributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.InnerClassName); + this.contents[localContentsOffset++] = (byte) (attributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) attributeNameIndex; + int value = (numberOfInnerClasses << 3) + 2; + this.contents[localContentsOffset++] = (byte) (value >> 24); + this.contents[localContentsOffset++] = (byte) (value >> 16); + this.contents[localContentsOffset++] = (byte) (value >> 8); + this.contents[localContentsOffset++] = (byte) value; + this.contents[localContentsOffset++] = (byte) (numberOfInnerClasses >> 8); + this.contents[localContentsOffset++] = (byte) numberOfInnerClasses; + for (int i = 0; i < numberOfInnerClasses; i++) { + ReferenceBinding innerClass = innerClasses[i]; + int accessFlags = innerClass.getAccessFlags(); +//{ObjectTeams: synthetic interfaces are illegal in class files (why???): + if ( (accessFlags & (ClassFileConstants.AccSynthetic|ClassFileConstants.AccInterface)) + == (ClassFileConstants.AccSynthetic|ClassFileConstants.AccInterface)) + { + accessFlags ^= ClassFileConstants.AccSynthetic; + } +//SH} + int innerClassIndex = this.constantPool.literalIndexForType(innerClass.constantPoolName()); + // inner class index + this.contents[localContentsOffset++] = (byte) (innerClassIndex >> 8); + this.contents[localContentsOffset++] = (byte) innerClassIndex; + // outer class index: anonymous and local have no outer class index + if (innerClass.isMemberType()) { + // member or member of local + int outerClassIndex = this.constantPool.literalIndexForType(innerClass.enclosingType().constantPoolName()); + this.contents[localContentsOffset++] = (byte) (outerClassIndex >> 8); + this.contents[localContentsOffset++] = (byte) outerClassIndex; + } else { + // equals to 0 if the innerClass is not a member type + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + } + // name index + if (!innerClass.isAnonymousType()) { +//{ObjectTeams: use real name not beautified version (was sourceName()). +/* orig: + int nameIndex = this.constantPool.literalIndex(innerClass.sourceName()); + :giro */ + int nameIndex = this.constantPool.literalIndex(innerClass.internalName()); +// SH} + + this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); + this.contents[localContentsOffset++] = (byte) nameIndex; + } else { + // equals to 0 if the innerClass is an anonymous type + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + } + // access flag + if (innerClass.isAnonymousType()) { + accessFlags &= ~ClassFileConstants.AccFinal; + } else if (innerClass.isMemberType() && innerClass.isInterface()) { + accessFlags |= ClassFileConstants.AccStatic; // implicitely static + } + this.contents[localContentsOffset++] = (byte) (accessFlags >> 8); + this.contents[localContentsOffset++] = (byte) accessFlags; + } + this.contentsOffset = localContentsOffset; + return 1; + } + private int generateLineNumberAttribute() { + int localContentsOffset = this.contentsOffset; + int attributesNumber = 0; + /* Create and add the line number attribute (used for debugging) + * Build the pairs of: + * (bytecodePC lineNumber) + * according to the table of start line indexes and the pcToSourceMap table + * contained into the codestream + */ + int[] pcToSourceMapTable; + if (((pcToSourceMapTable = this.codeStream.pcToSourceMap) != null) + && (this.codeStream.pcToSourceMapSize != 0)) { + int lineNumberNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); + if (localContentsOffset + 8 >= this.contents.length) { + resizeContents(8); + } + this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; + int lineNumberTableOffset = localContentsOffset; + localContentsOffset += 6; + // leave space for attribute_length and line_number_table_length + int numberOfEntries = 0; + int length = this.codeStream.pcToSourceMapSize; + for (int i = 0; i < length;) { + // write the entry + if (localContentsOffset + 4 >= this.contents.length) { + resizeContents(4); + } + int pc = pcToSourceMapTable[i++]; + this.contents[localContentsOffset++] = (byte) (pc >> 8); + this.contents[localContentsOffset++] = (byte) pc; + int lineNumber = pcToSourceMapTable[i++]; + this.contents[localContentsOffset++] = (byte) (lineNumber >> 8); + this.contents[localContentsOffset++] = (byte) lineNumber; + numberOfEntries++; + } + // now we change the size of the line number attribute + int lineNumberAttr_length = numberOfEntries * 4 + 2; + this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 24); + this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 16); + this.contents[lineNumberTableOffset++] = (byte) (lineNumberAttr_length >> 8); + this.contents[lineNumberTableOffset++] = (byte) lineNumberAttr_length; + this.contents[lineNumberTableOffset++] = (byte) (numberOfEntries >> 8); + this.contents[lineNumberTableOffset++] = (byte) numberOfEntries; + attributesNumber = 1; + } + this.contentsOffset = localContentsOffset; + return attributesNumber; + } + // this is used for problem and synthetic methods + private int generateLineNumberAttribute(int problemLine) { + int localContentsOffset = this.contentsOffset; + if (localContentsOffset + 12 >= this.contents.length) { + resizeContents(12); + } + /* Create and add the line number attribute (used for debugging) + * Build the pairs of: + * (bytecodePC lineNumber) + * according to the table of start line indexes and the pcToSourceMap table + * contained into the codestream + */ + int lineNumberNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.LineNumberTableName); + this.contents[localContentsOffset++] = (byte) (lineNumberNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) lineNumberNameIndex; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 6; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 1; + // first entry at pc = 0 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = (byte) (problemLine >> 8); + this.contents[localContentsOffset++] = (byte) problemLine; + // now we change the size of the line number attribute + this.contentsOffset = localContentsOffset; + return 1; + } + + private int generateLocalVariableTableAttribute(int code_length, boolean methodDeclarationIsStatic, boolean isSynthetic) { + int attributesNumber = 0; + int localContentsOffset = this.contentsOffset; + int numberOfEntries = 0; + int localVariableNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTableName); + int maxOfEntries = 8 + 10 * (methodDeclarationIsStatic ? 0 : 1); + for (int i = 0; i < this.codeStream.allLocalsCounter; i++) { + LocalVariableBinding localVariableBinding = this.codeStream.locals[i]; + maxOfEntries += 10 * localVariableBinding.initializationCount; + } + // reserve enough space + if (localContentsOffset + maxOfEntries >= this.contents.length) { + resizeContents(maxOfEntries); + } + this.contents[localContentsOffset++] = (byte) (localVariableNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) localVariableNameIndex; + int localVariableTableOffset = localContentsOffset; + // leave space for attribute_length and local_variable_table_length + localContentsOffset += 6; + int nameIndex; + int descriptorIndex; + SourceTypeBinding declaringClassBinding = null; + if (!methodDeclarationIsStatic && !isSynthetic) { + numberOfEntries++; + this.contents[localContentsOffset++] = 0; // the startPC for this is always 0 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = (byte) (code_length >> 8); + this.contents[localContentsOffset++] = (byte) code_length; + nameIndex = this.constantPool.literalIndex(ConstantPool.This); + this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); + this.contents[localContentsOffset++] = (byte) nameIndex; + declaringClassBinding = (SourceTypeBinding) this.codeStream.methodDeclaration.binding.declaringClass; + descriptorIndex = + this.constantPool.literalIndex( + declaringClassBinding.signature()); + this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); + this.contents[localContentsOffset++] = (byte) descriptorIndex; + this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0 + this.contents[localContentsOffset++] = 0; + } + // used to remember the local variable with a generic type + int genericLocalVariablesCounter = 0; + LocalVariableBinding[] genericLocalVariables = null; + int numberOfGenericEntries = 0; + + for (int i = 0, max = this.codeStream.allLocalsCounter; i < max; i++) { + LocalVariableBinding localVariable = this.codeStream.locals[i]; + int initializationCount = localVariable.initializationCount; + if (initializationCount == 0) continue; + if (localVariable.declaration == null) continue; + final TypeBinding localVariableTypeBinding = localVariable.type; + boolean isParameterizedType = localVariableTypeBinding.isParameterizedType() || localVariableTypeBinding.isTypeVariable(); + if (isParameterizedType) { + if (genericLocalVariables == null) { + // we cannot have more than max locals + genericLocalVariables = new LocalVariableBinding[max]; + } + genericLocalVariables[genericLocalVariablesCounter++] = localVariable; + } + for (int j = 0; j < initializationCount; j++) { + int startPC = localVariable.initializationPCs[j << 1]; + int endPC = localVariable.initializationPCs[(j << 1) + 1]; + if (startPC != endPC) { // only entries for non zero length + if (endPC == -1) { + localVariable.declaringScope.problemReporter().abortDueToInternalError( + Messages.bind(Messages.abort_invalidAttribute, new String(localVariable.name)), + (ASTNode) localVariable.declaringScope.methodScope().referenceContext); + } + if (isParameterizedType) { + numberOfGenericEntries++; + } + // now we can safely add the local entry + numberOfEntries++; + this.contents[localContentsOffset++] = (byte) (startPC >> 8); + this.contents[localContentsOffset++] = (byte) startPC; + int length = endPC - startPC; + this.contents[localContentsOffset++] = (byte) (length >> 8); + this.contents[localContentsOffset++] = (byte) length; + nameIndex = this.constantPool.literalIndex(localVariable.name); + this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); + this.contents[localContentsOffset++] = (byte) nameIndex; + descriptorIndex = this.constantPool.literalIndex(localVariableTypeBinding.signature()); + this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); + this.contents[localContentsOffset++] = (byte) descriptorIndex; + int resolvedPosition = localVariable.resolvedPosition; + this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); + this.contents[localContentsOffset++] = (byte) resolvedPosition; + } + } + } + int value = numberOfEntries * 10 + 2; + this.contents[localVariableTableOffset++] = (byte) (value >> 24); + this.contents[localVariableTableOffset++] = (byte) (value >> 16); + this.contents[localVariableTableOffset++] = (byte) (value >> 8); + this.contents[localVariableTableOffset++] = (byte) value; + this.contents[localVariableTableOffset++] = (byte) (numberOfEntries >> 8); + this.contents[localVariableTableOffset] = (byte) numberOfEntries; + attributesNumber++; + + final boolean currentInstanceIsGeneric = + !methodDeclarationIsStatic + && declaringClassBinding != null + && declaringClassBinding.typeVariables != Binding.NO_TYPE_VARIABLES; + if (genericLocalVariablesCounter != 0 || currentInstanceIsGeneric) { + // add the local variable type table attribute + numberOfGenericEntries += (currentInstanceIsGeneric ? 1 : 0); + maxOfEntries = 8 + numberOfGenericEntries * 10; + // reserve enough space + if (localContentsOffset + maxOfEntries >= this.contents.length) { + resizeContents(maxOfEntries); + } + int localVariableTypeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.LocalVariableTypeTableName); + this.contents[localContentsOffset++] = (byte) (localVariableTypeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) localVariableTypeNameIndex; + value = numberOfGenericEntries * 10 + 2; + this.contents[localContentsOffset++] = (byte) (value >> 24); + this.contents[localContentsOffset++] = (byte) (value >> 16); + this.contents[localContentsOffset++] = (byte) (value >> 8); + this.contents[localContentsOffset++] = (byte) value; + this.contents[localContentsOffset++] = (byte) (numberOfGenericEntries >> 8); + this.contents[localContentsOffset++] = (byte) numberOfGenericEntries; + if (currentInstanceIsGeneric) { + this.contents[localContentsOffset++] = 0; // the startPC for this is always 0 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = (byte) (code_length >> 8); + this.contents[localContentsOffset++] = (byte) code_length; + nameIndex = this.constantPool.literalIndex(ConstantPool.This); + this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); + this.contents[localContentsOffset++] = (byte) nameIndex; + descriptorIndex = this.constantPool.literalIndex(declaringClassBinding.genericTypeSignature()); + this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); + this.contents[localContentsOffset++] = (byte) descriptorIndex; + this.contents[localContentsOffset++] = 0;// the resolved position for this is always 0 + this.contents[localContentsOffset++] = 0; + } + + for (int i = 0; i < genericLocalVariablesCounter; i++) { + LocalVariableBinding localVariable = genericLocalVariables[i]; + for (int j = 0; j < localVariable.initializationCount; j++) { + int startPC = localVariable.initializationPCs[j << 1]; + int endPC = localVariable.initializationPCs[(j << 1) + 1]; + if (startPC != endPC) { + // only entries for non zero length + // now we can safely add the local entry + this.contents[localContentsOffset++] = (byte) (startPC >> 8); + this.contents[localContentsOffset++] = (byte) startPC; + int length = endPC - startPC; + this.contents[localContentsOffset++] = (byte) (length >> 8); + this.contents[localContentsOffset++] = (byte) length; + nameIndex = this.constantPool.literalIndex(localVariable.name); + this.contents[localContentsOffset++] = (byte) (nameIndex >> 8); + this.contents[localContentsOffset++] = (byte) nameIndex; + descriptorIndex = this.constantPool.literalIndex(localVariable.type.genericTypeSignature()); + this.contents[localContentsOffset++] = (byte) (descriptorIndex >> 8); + this.contents[localContentsOffset++] = (byte) descriptorIndex; + int resolvedPosition = localVariable.resolvedPosition; + this.contents[localContentsOffset++] = (byte) (resolvedPosition >> 8); + this.contents[localContentsOffset++] = (byte) resolvedPosition; + } + } + } + attributesNumber++; + } + this.contentsOffset = localContentsOffset; + return attributesNumber; + } /** * INTERNAL USE-ONLY * That method generates the attributes of a code attribute. @@ -6273,7 +2724,7 @@ public class ClassFile implements TypeConstants, TypeIds { * @param methodBinding org.eclipse.jdt.internal.compiler.lookup.MethodBinding * @return <CODE>int</CODE> */ - public int generateMethodInfoAttribute(MethodBinding methodBinding) { + public int generateMethodInfoAttributes(MethodBinding methodBinding) { // leave two bytes for the attribute_number this.contentsOffset += 2; if (this.contentsOffset + 2 >= this.contents.length) { @@ -6288,127 +2739,40 @@ public class ClassFile implements TypeConstants, TypeIds { // Exception attribute ReferenceBinding[] thrownsExceptions; - int attributeNumber = 0; + int attributesNumber = 0; if ((thrownsExceptions = methodBinding.thrownExceptions) != Binding.NO_EXCEPTIONS) { // The method has a throw clause. So we need to add an exception attribute // check that there is enough space to write all the bytes for the exception attribute - int length = thrownsExceptions.length; - int exSize = 8 + length * 2; - if (exSize + this.contentsOffset >= this.contents.length) { - resizeContents(exSize); - } - int exceptionNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.ExceptionsName); - this.contents[this.contentsOffset++] = (byte) (exceptionNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) exceptionNameIndex; - // The attribute length = length * 2 + 2 in case of a exception attribute - int attributeLength = length * 2 + 2; - this.contents[this.contentsOffset++] = (byte) (attributeLength >> 24); - this.contents[this.contentsOffset++] = (byte) (attributeLength >> 16); - this.contents[this.contentsOffset++] = (byte) (attributeLength >> 8); - this.contents[this.contentsOffset++] = (byte) attributeLength; - this.contents[this.contentsOffset++] = (byte) (length >> 8); - this.contents[this.contentsOffset++] = (byte) length; - for (int i = 0; i < length; i++) { - int exceptionIndex = this.constantPool.literalIndexForType(thrownsExceptions[i]); - this.contents[this.contentsOffset++] = (byte) (exceptionIndex >> 8); - this.contents[this.contentsOffset++] = (byte) exceptionIndex; - } - attributeNumber++; + attributesNumber += generateExceptionsAttribute(thrownsExceptions); } if (methodBinding.isDeprecated()) { // Deprecated attribute - // Check that there is enough space to write the deprecated attribute - if (this.contentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - int deprecatedAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.DeprecatedName); - this.contents[this.contentsOffset++] = (byte) (deprecatedAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) deprecatedAttributeNameIndex; - // the length of a deprecated attribute is equals to 0 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - - attributeNumber++; + attributesNumber += generateDeprecatedAttribute(); } if (this.targetJDK < ClassFileConstants.JDK1_5) { if (methodBinding.isSynthetic()) { - // Synthetic attribute - // Check that there is enough space to write the deprecated attribute - if (this.contentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - int syntheticAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.SyntheticName); - this.contents[this.contentsOffset++] = (byte) (syntheticAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) syntheticAttributeNameIndex; - // the length of a synthetic attribute is equals to 0 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - - attributeNumber++; + attributesNumber += generateSyntheticAttribute(); } if (methodBinding.isVarargs()) { - /* - * handle of the target jsr14 for varargs in the source - * Varargs attribute - * Check that there is enough space to write the deprecated attribute - */ - if (this.contentsOffset + 6 >= this.contents.length) { - resizeContents(6); - } - int varargsAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.VarargsName); - this.contents[this.contentsOffset++] = (byte) (varargsAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) varargsAttributeNameIndex; - // the length of a varargs attribute is equals to 0 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - - attributeNumber++; + attributesNumber += generateVarargsAttribute(); } } // add signature attribute char[] genericSignature = methodBinding.genericSignature(); if (genericSignature != null) { - // check that there is enough space to write all the bytes for the field info corresponding - // to the @fieldBinding - if (this.contentsOffset + 8 >= this.contents.length) { - resizeContents(8); - } - int signatureAttributeNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.SignatureName); - this.contents[this.contentsOffset++] = (byte) (signatureAttributeNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) signatureAttributeNameIndex; - // the length of a signature attribute is equals to 2 - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 0; - this.contents[this.contentsOffset++] = 2; - int signatureIndex = - this.constantPool.literalIndex(genericSignature); - this.contents[this.contentsOffset++] = (byte) (signatureIndex >> 8); - this.contents[this.contentsOffset++] = (byte) signatureIndex; - attributeNumber++; + attributesNumber += generateSignatureAttribute(genericSignature); } if (this.targetJDK >= ClassFileConstants.JDK1_4) { AbstractMethodDeclaration methodDeclaration = methodBinding.sourceMethod(); if (methodDeclaration != null) { Annotation[] annotations = methodDeclaration.annotations; if (annotations != null) { - attributeNumber += generateRuntimeAnnotations(annotations); + attributesNumber += generateRuntimeAnnotations(annotations); } if ((methodBinding.tagBits & TagBits.HasParameterAnnotations) != 0) { Argument[] arguments = methodDeclaration.arguments; if (arguments != null) { - attributeNumber += generateRuntimeAnnotationsForParameters(arguments); + attributesNumber += generateRuntimeAnnotationsForParameters(arguments); } } } @@ -6416,32 +2780,14 @@ public class ClassFile implements TypeConstants, TypeIds { if ((methodBinding.tagBits & TagBits.HasMissingType) != 0) { this.missingTypes = methodBinding.collectMissingTypes(this.missingTypes); } - return attributeNumber; + return attributesNumber; } - - public int generateMethodInfoAttribute(MethodBinding methodBinding, AnnotationMethodDeclaration declaration) { - int attributesNumber = generateMethodInfoAttribute(methodBinding); + public int generateMethodInfoAttributes(MethodBinding methodBinding, AnnotationMethodDeclaration declaration) { + int attributesNumber = generateMethodInfoAttributes(methodBinding); int attributeOffset = this.contentsOffset; if ((declaration.modifiers & ClassFileConstants.AccAnnotationDefault) != 0) { // add an annotation default attribute - int annotationDefaultNameIndex = - this.constantPool.literalIndex(AttributeNamesConstants.AnnotationDefaultName); - this.contents[this.contentsOffset++] = (byte) (annotationDefaultNameIndex >> 8); - this.contents[this.contentsOffset++] = (byte) annotationDefaultNameIndex; - int attributeLengthOffset = this.contentsOffset; - this.contentsOffset += 4; - if (this.contentsOffset + 4 >= this.contents.length) { - resizeContents(4); - } - generateElementValue(declaration.defaultValue, declaration.binding.returnType, attributeOffset); - if (this.contentsOffset != attributeOffset) { - int attributeLength = this.contentsOffset - attributeLengthOffset - 4; - this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 24); - this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 16); - this.contents[attributeLengthOffset++] = (byte) (attributeLength >> 8); - this.contents[attributeLengthOffset++] = (byte) attributeLength; - attributesNumber++; - } + attributesNumber += generateAnnotationDefaultAttribute(declaration, attributeOffset); } return attributesNumber; } @@ -6458,6 +2804,7 @@ public class ClassFile implements TypeConstants, TypeIds { public void generateMethodInfoHeader(MethodBinding methodBinding) { generateMethodInfoHeader(methodBinding, methodBinding.modifiers); } + /** * INTERNAL USE-ONLY * That method generates the header of a method info: @@ -6627,9 +2974,9 @@ public class ClassFile implements TypeConstants, TypeIds { for (int i = 0; i < length; i++) { Annotation annotation = annotations[i]; - if (isRuntimeInvisible(annotation)) { + if (annotation.isRuntimeInvisible()) { invisibleAnnotationsCounter++; - } else if (isRuntimeVisible(annotation)) { + } else if (annotation.isRuntimeVisible()) { visibleAnnotationsCounter++; } } @@ -6655,7 +3002,7 @@ public class ClassFile implements TypeConstants, TypeIds { loop: for (int i = 0; i < length; i++) { if (invisibleAnnotationsCounter == 0) break loop; Annotation annotation = annotations[i]; - if (isRuntimeInvisible(annotation)) { + if (annotation.isRuntimeInvisible()) { int currentAnnotationOffset = this.contentsOffset; generateAnnotation(annotation, currentAnnotationOffset); invisibleAnnotationsCounter--; @@ -6702,7 +3049,7 @@ public class ClassFile implements TypeConstants, TypeIds { loop: for (int i = 0; i < length; i++) { if (visibleAnnotationsCounter == 0) break loop; Annotation annotation = annotations[i]; - if (isRuntimeVisible(annotation)) { + if (annotation.isRuntimeVisible()) { visibleAnnotationsCounter--; int currentAnnotationOffset = this.contentsOffset; generateAnnotation(annotation, currentAnnotationOffset); @@ -6728,7 +3075,6 @@ public class ClassFile implements TypeConstants, TypeIds { } return attributesNumber; } - private int generateRuntimeAnnotationsForParameters(Argument[] arguments) { final int argumentsLength = arguments.length; final int VISIBLE_INDEX = 0; @@ -6742,10 +3088,10 @@ public class ClassFile implements TypeConstants, TypeIds { if (annotations != null) { for (int j = 0, max2 = annotations.length; j < max2; j++) { Annotation annotation = annotations[j]; - if (isRuntimeInvisible(annotation)) { + if (annotation.isRuntimeInvisible()) { annotationsCounters[i][INVISIBLE_INDEX]++; invisibleParametersAnnotationsCounter++; - } else if (isRuntimeVisible(annotation)) { + } else if (annotation.isRuntimeVisible()) { annotationsCounters[i][VISIBLE_INDEX]++; visibleParametersAnnotationsCounter++; } @@ -6785,7 +3131,7 @@ public class ClassFile implements TypeConstants, TypeIds { Annotation[] annotations = argument.annotations; for (int j = 0, max = annotations.length; j < max; j++) { Annotation annotation = annotations[j]; - if (isRuntimeInvisible(annotation)) { + if (annotation.isRuntimeInvisible()) { int currentAnnotationOffset = this.contentsOffset; generateAnnotation(annotation, currentAnnotationOffset); if (this.contentsOffset != currentAnnotationOffset) { @@ -6843,7 +3189,7 @@ public class ClassFile implements TypeConstants, TypeIds { Annotation[] annotations = argument.annotations; for (int j = 0, max = annotations.length; j < max; j++) { Annotation annotation = annotations[j]; - if (isRuntimeVisible(annotation)) { + if (annotation.isRuntimeVisible()) { int currentAnnotationOffset = this.contentsOffset; generateAnnotation(annotation, currentAnnotationOffset); if (this.contentsOffset != currentAnnotationOffset) { @@ -6873,6 +3219,629 @@ public class ClassFile implements TypeConstants, TypeIds { return attributesNumber; } + private int generateSignatureAttribute(char[] genericSignature) { + int localContentsOffset = this.contentsOffset; + if (localContentsOffset + 8 >= this.contents.length) { + resizeContents(8); + } + int signatureAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.SignatureName); + this.contents[localContentsOffset++] = (byte) (signatureAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) signatureAttributeNameIndex; + // the length of a signature attribute is equals to 2 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 2; + int signatureIndex = + this.constantPool.literalIndex(genericSignature); + this.contents[localContentsOffset++] = (byte) (signatureIndex >> 8); + this.contents[localContentsOffset++] = (byte) signatureIndex; + this.contentsOffset = localContentsOffset; + return 1; + } + + private int generateSourceAttribute(String fullFileName) { + int localContentsOffset = this.contentsOffset; + // check that there is enough space to write all the bytes for the field info corresponding + // to the @fieldBinding + if (localContentsOffset + 8 >= this.contents.length) { + resizeContents(8); + } + int sourceAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.SourceName); + this.contents[localContentsOffset++] = (byte) (sourceAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) sourceAttributeNameIndex; + // The length of a source file attribute is 2. This is a fixed-length + // attribute + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 2; + // write the source file name + int fileNameIndex = this.constantPool.literalIndex(fullFileName.toCharArray()); + this.contents[localContentsOffset++] = (byte) (fileNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) fileNameIndex; + this.contentsOffset = localContentsOffset; + return 1; + } + private int generateStackMapAttribute( + MethodBinding methodBinding, + int code_length, + int codeAttributeOffset, + int max_locals, + boolean isClinit) { + int attributesNumber = 0; + int localContentsOffset = this.contentsOffset; + StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; + stackMapFrameCodeStream.removeFramePosition(code_length); + if (stackMapFrameCodeStream.hasFramePositions()) { + ArrayList frames = new ArrayList(); + traverse(isClinit ? null : methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit); + int numberOfFrames = frames.size(); + if (numberOfFrames > 1) { + int stackMapTableAttributeOffset = localContentsOffset; + // add the stack map table attribute + if (localContentsOffset + 8 >= this.contents.length) { + resizeContents(8); + } + int stackMapAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.StackMapName); + this.contents[localContentsOffset++] = (byte) (stackMapAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) stackMapAttributeNameIndex; + + int stackMapAttributeLengthOffset = localContentsOffset; + // generate the attribute + localContentsOffset += 4; + if (localContentsOffset + 4 >= this.contents.length) { + resizeContents(4); + } + int numberOfFramesOffset = localContentsOffset; + localContentsOffset += 2; + if (localContentsOffset + 2 >= this.contents.length) { + resizeContents(2); + } + StackMapFrame currentFrame = (StackMapFrame) frames.get(0); + for (int j = 1; j < numberOfFrames; j++) { + // select next frame + currentFrame = (StackMapFrame) frames.get(j); + // generate current frame + // need to find differences between the current frame and the previous frame + int frameOffset = currentFrame.pc; + // FULL_FRAME + if (localContentsOffset + 5 >= this.contents.length) { + resizeContents(5); + } + this.contents[localContentsOffset++] = (byte) (frameOffset >> 8); + this.contents[localContentsOffset++] = (byte) frameOffset; + int numberOfLocalOffset = localContentsOffset; + localContentsOffset += 2; // leave two spots for number of locals + int numberOfLocalEntries = 0; + int numberOfLocals = currentFrame.getNumberOfLocals(); + int numberOfEntries = 0; + int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; + for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { + if (localContentsOffset + 3 >= this.contents.length) { + resizeContents(3); + } + VerificationTypeInfo info = currentFrame.locals[i]; + if (info == null) { + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; + } else { + switch(info.id()) { + case T_boolean : + case T_byte : + case T_char : + case T_int : + case T_short : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; + break; + case T_float : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; + break; + case T_long : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; + i++; + break; + case T_double : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; + i++; + break; + case T_null : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; + break; + default: + this.contents[localContentsOffset++] = (byte) info.tag; + switch (info.tag) { + case VerificationTypeInfo.ITEM_UNINITIALIZED : + int offset = info.offset; + this.contents[localContentsOffset++] = (byte) (offset >> 8); + this.contents[localContentsOffset++] = (byte) offset; + break; + case VerificationTypeInfo.ITEM_OBJECT : + int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); + this.contents[localContentsOffset++] = (byte) (indexForType >> 8); + this.contents[localContentsOffset++] = (byte) indexForType; + } + } + numberOfLocalEntries++; + } + numberOfEntries++; + } + if (localContentsOffset + 4 >= this.contents.length) { + resizeContents(4); + } + this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); + this.contents[numberOfLocalOffset] = (byte) numberOfEntries; + int numberOfStackItems = currentFrame.numberOfStackItems; + this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); + this.contents[localContentsOffset++] = (byte) numberOfStackItems; + for (int i = 0; i < numberOfStackItems; i++) { + if (localContentsOffset + 3 >= this.contents.length) { + resizeContents(3); + } + VerificationTypeInfo info = currentFrame.stackItems[i]; + if (info == null) { + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; + } else { + switch(info.id()) { + case T_boolean : + case T_byte : + case T_char : + case T_int : + case T_short : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; + break; + case T_float : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; + break; + case T_long : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; + break; + case T_double : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; + break; + case T_null : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; + break; + default: + this.contents[localContentsOffset++] = (byte) info.tag; + switch (info.tag) { + case VerificationTypeInfo.ITEM_UNINITIALIZED : + int offset = info.offset; + this.contents[localContentsOffset++] = (byte) (offset >> 8); + this.contents[localContentsOffset++] = (byte) offset; + break; + case VerificationTypeInfo.ITEM_OBJECT : + int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); + this.contents[localContentsOffset++] = (byte) (indexForType >> 8); + this.contents[localContentsOffset++] = (byte) indexForType; + } + } + } + } + } + + numberOfFrames--; + if (numberOfFrames != 0) { + this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); + this.contents[numberOfFramesOffset] = (byte) numberOfFrames; + + int attributeLength = localContentsOffset - stackMapAttributeLengthOffset - 4; + this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 24); + this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 16); + this.contents[stackMapAttributeLengthOffset++] = (byte) (attributeLength >> 8); + this.contents[stackMapAttributeLengthOffset] = (byte) attributeLength; + attributesNumber++; + } else { + localContentsOffset = stackMapTableAttributeOffset; + } + } + } + this.contentsOffset = localContentsOffset; + return attributesNumber; + } + + private int generateStackMapTableAttribute( + MethodBinding methodBinding, + int code_length, + int codeAttributeOffset, + int max_locals, + boolean isClinit) { + int attributesNumber = 0; + int localContentsOffset = this.contentsOffset; + StackMapFrameCodeStream stackMapFrameCodeStream = (StackMapFrameCodeStream) this.codeStream; + stackMapFrameCodeStream.removeFramePosition(code_length); + if (stackMapFrameCodeStream.hasFramePositions()) { + ArrayList frames = new ArrayList(); + traverse(isClinit ? null: methodBinding, max_locals, this.contents, codeAttributeOffset + 14, code_length, frames, isClinit); + int numberOfFrames = frames.size(); + if (numberOfFrames > 1) { + int stackMapTableAttributeOffset = localContentsOffset; + // add the stack map table attribute + if (localContentsOffset + 8 >= this.contents.length) { + resizeContents(8); + } + int stackMapTableAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.StackMapTableName); + this.contents[localContentsOffset++] = (byte) (stackMapTableAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) stackMapTableAttributeNameIndex; + + int stackMapTableAttributeLengthOffset = localContentsOffset; + // generate the attribute + localContentsOffset += 4; + if (localContentsOffset + 4 >= this.contents.length) { + resizeContents(4); + } + int numberOfFramesOffset = localContentsOffset; + localContentsOffset += 2; + if (localContentsOffset + 2 >= this.contents.length) { + resizeContents(2); + } + StackMapFrame currentFrame = (StackMapFrame) frames.get(0); + StackMapFrame prevFrame = null; + for (int j = 1; j < numberOfFrames; j++) { + // select next frame + prevFrame = currentFrame; + currentFrame = (StackMapFrame) frames.get(j); + // generate current frame + // need to find differences between the current frame and the previous frame + int offsetDelta = currentFrame.getOffsetDelta(prevFrame); + switch (currentFrame.getFrameType(prevFrame)) { + case StackMapFrame.APPEND_FRAME : + if (localContentsOffset + 3 >= this.contents.length) { + resizeContents(3); + } + int numberOfDifferentLocals = currentFrame.numberOfDifferentLocals(prevFrame); + this.contents[localContentsOffset++] = (byte) (251 + numberOfDifferentLocals); + this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); + this.contents[localContentsOffset++] = (byte) offsetDelta; + int index = currentFrame.getIndexOfDifferentLocals(numberOfDifferentLocals); + int numberOfLocals = currentFrame.getNumberOfLocals(); + for (int i = index; i < currentFrame.locals.length && numberOfDifferentLocals > 0; i++) { + if (localContentsOffset + 6 >= this.contents.length) { + resizeContents(6); + } + VerificationTypeInfo info = currentFrame.locals[i]; + if (info == null) { + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; + } else { + switch(info.id()) { + case T_boolean : + case T_byte : + case T_char : + case T_int : + case T_short : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; + break; + case T_float : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; + break; + case T_long : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; + i++; + break; + case T_double : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; + i++; + break; + case T_null : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; + break; + default: + this.contents[localContentsOffset++] = (byte) info.tag; + switch (info.tag) { + case VerificationTypeInfo.ITEM_UNINITIALIZED : + int offset = info.offset; + this.contents[localContentsOffset++] = (byte) (offset >> 8); + this.contents[localContentsOffset++] = (byte) offset; + break; + case VerificationTypeInfo.ITEM_OBJECT : + int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); + this.contents[localContentsOffset++] = (byte) (indexForType >> 8); + this.contents[localContentsOffset++] = (byte) indexForType; + } + } + numberOfDifferentLocals--; + } + } + break; + case StackMapFrame.SAME_FRAME : + if (localContentsOffset + 1 >= this.contents.length) { + resizeContents(1); + } + this.contents[localContentsOffset++] = (byte) offsetDelta; + break; + case StackMapFrame.SAME_FRAME_EXTENDED : + if (localContentsOffset + 3 >= this.contents.length) { + resizeContents(3); + } + this.contents[localContentsOffset++] = (byte) 251; + this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); + this.contents[localContentsOffset++] = (byte) offsetDelta; + break; + case StackMapFrame.CHOP_FRAME : + if (localContentsOffset + 3 >= this.contents.length) { + resizeContents(3); + } + numberOfDifferentLocals = -currentFrame.numberOfDifferentLocals(prevFrame); + this.contents[localContentsOffset++] = (byte) (251 - numberOfDifferentLocals); + this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); + this.contents[localContentsOffset++] = (byte) offsetDelta; + break; + case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS : + if (localContentsOffset + 4 >= this.contents.length) { + resizeContents(4); + } + this.contents[localContentsOffset++] = (byte) (offsetDelta + 64); + if (currentFrame.stackItems[0] == null) { + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; + } else { + switch(currentFrame.stackItems[0].id()) { + case T_boolean : + case T_byte : + case T_char : + case T_int : + case T_short : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; + break; + case T_float : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; + break; + case T_long : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; + break; + case T_double : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; + break; + case T_null : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; + break; + default: + VerificationTypeInfo info = currentFrame.stackItems[0]; + byte tag = (byte) info.tag; + this.contents[localContentsOffset++] = tag; + switch (tag) { + case VerificationTypeInfo.ITEM_UNINITIALIZED : + int offset = info.offset; + this.contents[localContentsOffset++] = (byte) (offset >> 8); + this.contents[localContentsOffset++] = (byte) offset; + break; + case VerificationTypeInfo.ITEM_OBJECT : + int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); + this.contents[localContentsOffset++] = (byte) (indexForType >> 8); + this.contents[localContentsOffset++] = (byte) indexForType; + } + } + } + break; + case StackMapFrame.SAME_LOCALS_1_STACK_ITEMS_EXTENDED : + if (localContentsOffset + 6 >= this.contents.length) { + resizeContents(6); + } + this.contents[localContentsOffset++] = (byte) 247; + this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); + this.contents[localContentsOffset++] = (byte) offsetDelta; + if (currentFrame.stackItems[0] == null) { + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; + } else { + switch(currentFrame.stackItems[0].id()) { + case T_boolean : + case T_byte : + case T_char : + case T_int : + case T_short : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; + break; + case T_float : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; + break; + case T_long : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; + break; + case T_double : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; + break; + case T_null : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; + break; + default: + VerificationTypeInfo info = currentFrame.stackItems[0]; + byte tag = (byte) info.tag; + this.contents[localContentsOffset++] = tag; + switch (tag) { + case VerificationTypeInfo.ITEM_UNINITIALIZED : + int offset = info.offset; + this.contents[localContentsOffset++] = (byte) (offset >> 8); + this.contents[localContentsOffset++] = (byte) offset; + break; + case VerificationTypeInfo.ITEM_OBJECT : + int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); + this.contents[localContentsOffset++] = (byte) (indexForType >> 8); + this.contents[localContentsOffset++] = (byte) indexForType; + } + } + } + break; + default : + // FULL_FRAME + if (localContentsOffset + 5 >= this.contents.length) { + resizeContents(5); + } + this.contents[localContentsOffset++] = (byte) 255; + this.contents[localContentsOffset++] = (byte) (offsetDelta >> 8); + this.contents[localContentsOffset++] = (byte) offsetDelta; + int numberOfLocalOffset = localContentsOffset; + localContentsOffset += 2; // leave two spots for number of locals + int numberOfLocalEntries = 0; + numberOfLocals = currentFrame.getNumberOfLocals(); + int numberOfEntries = 0; + int localsLength = currentFrame.locals == null ? 0 : currentFrame.locals.length; + for (int i = 0; i < localsLength && numberOfLocalEntries < numberOfLocals; i++) { + if (localContentsOffset + 3 >= this.contents.length) { + resizeContents(3); + } + VerificationTypeInfo info = currentFrame.locals[i]; + if (info == null) { + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; + } else { + switch(info.id()) { + case T_boolean : + case T_byte : + case T_char : + case T_int : + case T_short : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; + break; + case T_float : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; + break; + case T_long : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; + i++; + break; + case T_double : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; + i++; + break; + case T_null : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; + break; + default: + this.contents[localContentsOffset++] = (byte) info.tag; + switch (info.tag) { + case VerificationTypeInfo.ITEM_UNINITIALIZED : + int offset = info.offset; + this.contents[localContentsOffset++] = (byte) (offset >> 8); + this.contents[localContentsOffset++] = (byte) offset; + break; + case VerificationTypeInfo.ITEM_OBJECT : + int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); + this.contents[localContentsOffset++] = (byte) (indexForType >> 8); + this.contents[localContentsOffset++] = (byte) indexForType; + } + } + numberOfLocalEntries++; + } + numberOfEntries++; + } + if (localContentsOffset + 4 >= this.contents.length) { + resizeContents(4); + } + this.contents[numberOfLocalOffset++] = (byte) (numberOfEntries >> 8); + this.contents[numberOfLocalOffset] = (byte) numberOfEntries; + int numberOfStackItems = currentFrame.numberOfStackItems; + this.contents[localContentsOffset++] = (byte) (numberOfStackItems >> 8); + this.contents[localContentsOffset++] = (byte) numberOfStackItems; + for (int i = 0; i < numberOfStackItems; i++) { + if (localContentsOffset + 3 >= this.contents.length) { + resizeContents(3); + } + VerificationTypeInfo info = currentFrame.stackItems[i]; + if (info == null) { + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_TOP; + } else { + switch(info.id()) { + case T_boolean : + case T_byte : + case T_char : + case T_int : + case T_short : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_INTEGER; + break; + case T_float : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_FLOAT; + break; + case T_long : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_LONG; + break; + case T_double : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_DOUBLE; + break; + case T_null : + this.contents[localContentsOffset++] = (byte) VerificationTypeInfo.ITEM_NULL; + break; + default: + this.contents[localContentsOffset++] = (byte) info.tag; + switch (info.tag) { + case VerificationTypeInfo.ITEM_UNINITIALIZED : + int offset = info.offset; + this.contents[localContentsOffset++] = (byte) (offset >> 8); + this.contents[localContentsOffset++] = (byte) offset; + break; + case VerificationTypeInfo.ITEM_OBJECT : + int indexForType = this.constantPool.literalIndexForType(info.constantPoolName()); + this.contents[localContentsOffset++] = (byte) (indexForType >> 8); + this.contents[localContentsOffset++] = (byte) indexForType; + } + } + } + } + } + } + + numberOfFrames--; + if (numberOfFrames != 0) { + this.contents[numberOfFramesOffset++] = (byte) (numberOfFrames >> 8); + this.contents[numberOfFramesOffset] = (byte) numberOfFrames; + + int attributeLength = localContentsOffset - stackMapTableAttributeLengthOffset - 4; + this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 24); + this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 16); + this.contents[stackMapTableAttributeLengthOffset++] = (byte) (attributeLength >> 8); + this.contents[stackMapTableAttributeLengthOffset] = (byte) attributeLength; + attributesNumber++; + } else { + localContentsOffset = stackMapTableAttributeOffset; + } + } + } + this.contentsOffset = localContentsOffset; + return attributesNumber; + } + + private int generateSyntheticAttribute() { + int localContentsOffset = this.contentsOffset; + if (localContentsOffset + 6 >= this.contents.length) { + resizeContents(6); + } + int syntheticAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.SyntheticName); + this.contents[localContentsOffset++] = (byte) (syntheticAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) syntheticAttributeNameIndex; + // the length of a synthetic attribute is equals to 0 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contentsOffset = localContentsOffset; + return 1; + } + + private int generateVarargsAttribute() { + int localContentsOffset = this.contentsOffset; + /* + * handle of the target jsr14 for varargs in the source + * Varargs attribute + * Check that there is enough space to write the attribute + */ + if (localContentsOffset + 6 >= this.contents.length) { + resizeContents(6); + } + int varargsAttributeNameIndex = + this.constantPool.literalIndex(AttributeNamesConstants.VarargsName); + this.contents[localContentsOffset++] = (byte) (varargsAttributeNameIndex >> 8); + this.contents[localContentsOffset++] = (byte) varargsAttributeNameIndex; + // the length of a varargs attribute is equals to 0 + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + this.contents[localContentsOffset++] = 0; + + this.contentsOffset = localContentsOffset; + return 1; + } + /** * EXTERNAL API * Answer the actual bytes of the class file @@ -7017,6 +3986,10 @@ public class ClassFile implements TypeConstants, TypeIds { if (aType.isAnonymousType()) { accessFlags &= ~ClassFileConstants.AccFinal; } + int finalAbstract = ClassFileConstants.AccFinal | ClassFileConstants.AccAbstract; + if ((accessFlags & finalAbstract) == finalAbstract) { + accessFlags &= ~finalAbstract; + } this.enclosingClassFile = parentClassFile; // innerclasses get their names computed at code gen time @@ -7252,31 +4225,6 @@ public class ClassFile implements TypeConstants, TypeIds { } } } - - private boolean isRuntimeInvisible(Annotation annotation) { - final TypeBinding annotationBinding = annotation.resolvedType; - if (annotationBinding == null) { - return false; - } - long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference - if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) - return true; // by default the retention is CLASS - - return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention; - } - - private boolean isRuntimeVisible(Annotation annotation) { - final TypeBinding annotationBinding = annotation.resolvedType; - if (annotationBinding == null) { - return false; - } - long metaTagBits = annotationBinding.getAnnotationTagBits(); - if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) - return false; // by default the retention is CLASS - - return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention; - } - /** * INTERNAL USE-ONLY * Returns the most enclosing classfile of the receiver. This is used know to store the constant pool name @@ -8501,10 +5449,10 @@ public class ClassFile implements TypeConstants, TypeIds { int classNameLength = className.length; if (className[0] != '[') { // this is a type name (class or interface). So we add appropriate '[', 'L' and ';'. - System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 3]), 2, classNameLength); - constantPoolName[0] = '['; - constantPoolName[1] = 'L'; - constantPoolName[classNameLength + 2] = ';'; + System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 3]), 2, classNameLength); + constantPoolName[0] = '['; + constantPoolName[1] = 'L'; + constantPoolName[classNameLength + 2] = ';'; } else { // if class name is already an array, we just need to add one dimension System.arraycopy(className, 0, (constantPoolName = new char[classNameLength + 1]), 1, classNameLength); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java index a409d4b0a..f1804a570 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -60,6 +61,12 @@ public class AND_AND_Expression extends BinaryExpression { } } rightInfo = this.right.analyseCode(currentScope, flowContext, rightInfo); + if ((this.left.implicitConversion & TypeIds.UNBOXING) != 0) { + this.left.checkNPE(currentScope, flowContext, flowInfo); + } + if ((this.right.implicitConversion & TypeIds.UNBOXING) != 0) { + this.right.checkNPE(currentScope, flowContext, flowInfo); + } FlowInfo mergedInfo = FlowInfo.conditional( rightInfo.safeInitsWhenTrue(), leftInfo.initsWhenFalse().unconditionalInits().mergedWith( diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java index fdc3fd68c..e353aa53e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java @@ -402,7 +402,7 @@ public abstract class AbstractMethodDeclaration classFile.generateMethodInfoHeader(this.binding); int methodAttributeOffset = classFile.contentsOffset; - int attributeNumber = classFile.generateMethodInfoAttribute(this.binding); + int attributeNumber = classFile.generateMethodInfoAttributes(this.binding); //{ObjectTeams: write OT-specific byte code attributes if (this.model != null) attributeNumber += this.model.writeAttributes(classFile); @@ -477,7 +477,7 @@ public abstract class AbstractMethodDeclaration } else { checkArgumentsSize(); } - classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); + classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber); } //{ObjectTeams: recording byte code public void maybeRecordByteCode(ClassFile classFile, int methodAttributeOffset) { @@ -512,7 +512,7 @@ public abstract class AbstractMethodDeclaration private void checkArgumentsSize() { TypeBinding[] parameters = this.binding.parameters; - int size = 1; // an abstact method or a native method cannot be static + int size = 1; // an abstract method or a native method cannot be static for (int i = 0, max = parameters.length; i < max; i++) { switch(parameters[i].id) { case TypeIds.T_long : @@ -755,7 +755,9 @@ public abstract class AbstractMethodDeclaration // SH} } } else if ((this.bits & UndocumentedEmptyBlock) != 0) { - this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd+1); + if (!this.isConstructor() || this.arguments != null) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=319626 + this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd+1); + } } //{ObjectTeams: } finally { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java index 42f6113eb..892f69a0e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java @@ -8,7 +8,9 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Stephan Herrmann - Contribution for bug 236385 + * Stephan Herrmann - Contributions for + * bug 236385 - [compiler] Warn for potential programming problem if an object is created but not used + * bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -79,6 +81,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl this.arguments[i] .analyseCode(currentScope, flowContext, flowInfo) .unconditionalInits(); + if ((this.arguments[i].implicitConversion & TypeIds.UNBOXING) != 0) { + this.arguments[i].checkNPE(currentScope, flowContext, flowInfo); + } } } // record some dependency information for exception types diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java index c169b9a2d..6044b0252 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -176,6 +176,30 @@ public abstract class Annotation extends Expression { return this.compilerAnnotation; } + public boolean isRuntimeInvisible() { + final TypeBinding annotationBinding = this.resolvedType; + if (annotationBinding == null) { + return false; + } + long metaTagBits = annotationBinding.getAnnotationTagBits(); // could be forward reference + if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) + return true; // by default the retention is CLASS + + return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationClassRetention; + } + + public boolean isRuntimeVisible() { + final TypeBinding annotationBinding = this.resolvedType; + if (annotationBinding == null) { + return false; + } + long metaTagBits = annotationBinding.getAnnotationTagBits(); + if ((metaTagBits & TagBits.AnnotationRetentionMASK) == 0) + return false; // by default the retention is CLASS + + return (metaTagBits & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention; + } + public abstract MemberValuePair[] memberValuePairs(); public StringBuffer printExpression(int indent, StringBuffer output) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java index 52a2fc876..8860ec626 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -32,8 +32,8 @@ public class AnnotationMethodDeclaration extends MethodDeclaration { public void generateCode(ClassFile classFile) { classFile.generateMethodInfoHeader(this.binding); int methodAttributeOffset = classFile.contentsOffset; - int attributeNumber = classFile.generateMethodInfoAttribute(this.binding, this); - classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); + int attributeNumber = classFile.generateMethodInfoAttributes(this.binding, this); + classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber); } public boolean isAnnotationMethod() { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java index 4e93750ab..8a8a68321 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -41,6 +42,9 @@ public class ArrayAllocationExpression extends Expression { Expression dim; if ((dim = this.dimensions[i]) != null) { flowInfo = dim.analyseCode(currentScope, flowContext, flowInfo); + if ((dim.implicitConversion & TypeIds.UNBOXING) != 0) { + dim.checkNPE(currentScope, flowContext, flowInfo); + } } } if (this.initializer != null) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java index bab16b368..d1887e215 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -42,6 +43,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl this.preAssertInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo); Constant cst = this.assertExpression.optimizedBooleanConstant(); + if ((this.assertExpression.implicitConversion & TypeIds.UNBOXING) != 0) { + this.assertExpression.checkNPE(currentScope, flowContext, flowInfo); + } boolean isOptimizedTrueAssertion = cst != Constant.NotAConstant && cst.booleanValue() == true; boolean isOptimizedFalseAssertion = cst != Constant.NotAConstant && cst.booleanValue() == false; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java index f0711afc7..b5c54391c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -9,6 +9,8 @@ * Contributors: * IBM Corporation - initial API and implementation * Genady Beriozkin - added support for reporting assignment with no effect + * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE + * and bug 292478 - Report potentially null across variable assignment * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -69,6 +71,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl // a field reference, a blank final field reference, a field of an enclosing instance or // just a local variable. LocalVariableBinding local = this.lhs.localVariableBinding(); + if ((this.expression.implicitConversion & TypeIds.UNBOXING) != 0) { + this.expression.checkNPE(currentScope, flowContext, flowInfo); + } int nullStatus = this.expression.nullStatus(flowInfo); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { if (nullStatus == FlowInfo.NULL) { @@ -80,28 +85,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl .analyseAssignment(currentScope, flowContext, flowInfo, this, false) .unconditionalInits(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { - switch(nullStatus) { - case FlowInfo.NULL : - flowInfo.markAsDefinitelyNull(local); - break; - case FlowInfo.NON_NULL : - flowInfo.markAsDefinitelyNonNull(local); - break; - default: - flowInfo.markAsDefinitelyUnknown(local); - } - if (flowContext.initsOnFinally != null) { - switch(nullStatus) { - case FlowInfo.NULL : - flowContext.initsOnFinally.markAsDefinitelyNull(local); - break; - case FlowInfo.NON_NULL : - flowContext.initsOnFinally.markAsDefinitelyNonNull(local); - break; - default: - flowContext.initsOnFinally.markAsDefinitelyUnknown(local); - } - } + flowInfo.markNullStatus(local, nullStatus); + if (flowContext.initsOnFinally != null) + flowContext.initsOnFinally.markNullStatus(local, nullStatus); } return flowInfo; } @@ -192,7 +178,7 @@ public TypeBinding resolveType(BlockScope scope) { } // check for assignment with no effect Binding left = getDirectBinding(this.lhs); - if (left != null && left == getDirectBinding(this.expression)) { + if (left != null && !left.isVolatile() && left == getDirectBinding(this.expression)) { scope.problemReporter().assignmentHasNoEffect(this, left.shortReadableName()); } //{ObjectTeams: wrap rhs type: diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java index 3712e6255..3c5991878 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -82,8 +82,8 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl } public StringBuffer printStatement(int tab, StringBuffer output) { - printIndent(tab, output).append("break "); //$NON-NLS-1$ - if (this.label != null) output.append(this.label); + printIndent(tab, output).append("break"); //$NON-NLS-1$ + if (this.label != null) output.append(' ').append(this.label); return output.append(';'); } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java index 7eb4c340a..42bf55992 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -53,12 +53,12 @@ public FlowInfo analyseCode( public StringBuffer printStatement(int tab, StringBuffer output) { printIndent(tab, output); if (this.constantExpression == null) { - output.append("default : "); //$NON-NLS-1$ + output.append("default :"); //$NON-NLS-1$ } else { output.append("case "); //$NON-NLS-1$ - this.constantExpression.printExpression(0, output).append(" : "); //$NON-NLS-1$ + this.constantExpression.printExpression(0, output).append(" :"); //$NON-NLS-1$ } - return output.append(';'); + return output; } /** diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java index aad51d273..aaf8da627 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java @@ -9,6 +9,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752) + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -139,9 +140,13 @@ public CastExpression(Expression expression, Expression type) { } public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { - return this.expression + FlowInfo result = this.expression .analyseCode(currentScope, flowContext, flowInfo) .unconditionalInits(); + if ((this.expression.implicitConversion & TypeIds.UNBOXING) != 0) { + this.expression.checkNPE(currentScope, flowContext, flowInfo); + } + return result; } /** @@ -338,6 +343,7 @@ private static void checkAlternateBinding(BlockScope scope, Expression receiver, public void setFieldIndex(int depth){ /* ignore */} public int sourceStart() { return 0; } public int sourceEnd() { return 0; } + public TypeBinding expectedType() { return invocationSite.expectedType(); } }; MethodBinding bindingIfNoCast; if (binding.isConstructor()) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java index 069bab1a3..edd5f83b4 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java @@ -111,6 +111,16 @@ public class ClassLiteralAccess extends Expression { this.constant = Constant.NotAConstant; if ((this.targetType = this.type.resolveType(scope, true /* check bounds*/)) == null) return null; + + /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=320463 + https://bugs.eclipse.org/bugs/show_bug.cgi?id=312076 + JLS3 15.8.2 forbids the type named in the class literal expression from being a parameterized type. + And the grammar in 18.1 disallows (where X and Y are some concrete types) constructs of the form + Outer<X>.class, Outer<X>.Inner.class, Outer.Inner<X>.class, Outer<X>.Inner<Y>.class etc. + Corollary wise, we should resolve the type of the class literal expression to be a raw type as + class literals exist only for the raw underlying type. + */ + this.targetType = scope.environment().convertToRawType(this.targetType, true /* force conversion of enclosing types*/); if (this.targetType.isArrayType()) { ArrayBinding arrayBinding = (ArrayBinding) this.targetType; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java index a1473e979..5f4c7f624 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java @@ -378,7 +378,7 @@ public void finalizeProblems() { IrritantSet tokenIrritants = CompilerOptions.warningTokenToIrritants(cst.stringValue()); if (tokenIrritants != null && !tokenIrritants.areAllSet() // no complaint against @SuppressWarnings("all") - && options.isAnyEnabled(tokenIrritants) // if irritant is effectevely enabled + && options.isAnyEnabled(tokenIrritants) // if irritant is effectively enabled && (foundIrritants[iSuppress] == null || !foundIrritants[iSuppress].isAnySet(tokenIrritants))) { // if irritant had no matching problem if (unusedWarningTokenIsWarning) { int start = value.sourceStart, end = value.sourceEnd; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java index 98b5330e4..a0241c180 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephen Herrmann <stephan@cs.tu-berlin.de> - Contributions for bugs 133125, 292478 * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -332,8 +333,19 @@ public int nullStatus(FlowInfo flowInfo) { if (ifTrueNullStatus == ifFalseNullStatus) { return ifTrueNullStatus; } + // is there a chance of null (or non-null)? -> potentially null etc. + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=133125 + int status = 0; + int combinedStatus = ifTrueNullStatus|ifFalseNullStatus; + if ((combinedStatus & (FlowInfo.NULL|FlowInfo.POTENTIALLY_NULL)) != 0) + status |= FlowInfo.POTENTIALLY_NULL; + if ((combinedStatus & (FlowInfo.NON_NULL|FlowInfo.POTENTIALLY_NON_NULL)) != 0) + status |= FlowInfo.POTENTIALLY_NON_NULL; + if ((combinedStatus & (FlowInfo.UNKNOWN|FlowInfo.POTENTIALLY_UNKNOWN)) != 0) + status |= FlowInfo.POTENTIALLY_UNKNOWN; + if (status > 0) + return status; return FlowInfo.UNKNOWN; - // cannot decide which branch to take, and they disagree } public Constant optimizedBooleanConstant() { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java index 7617bc80e..58fb2952a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java @@ -437,7 +437,7 @@ public void generateSyntheticFieldInitializationsIfNecessary(MethodScope methodS private void internalGenerateCode(ClassScope classScope, ClassFile classFile) { classFile.generateMethodInfoHeader(this.binding); int methodAttributeOffset = classFile.contentsOffset; - int attributeNumber = classFile.generateMethodInfoAttribute(this.binding); + int attributeNumber = classFile.generateMethodInfoAttributes(this.binding); //{ObjectTeams: write OT-specific byte code attributes if (this.model != null) attributeNumber += this.model.writeAttributes(classFile); @@ -598,7 +598,7 @@ private void internalGenerateCode(ClassScope classScope, ClassFile classFile) { ((StackMapFrameCodeStream) codeStream).resetSecretLocals(); } } - classFile.completeMethodInfo(methodAttributeOffset, attributeNumber); + classFile.completeMethodInfo(this.binding, methodAttributeOffset, attributeNumber); } //{ObjectTeams: ctors are copied for roles and teams: diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java index 3228d4628..cf091277a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -57,6 +58,8 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl int previousMode = flowInfo.reachMode(); + FlowInfo initsOnCondition = flowInfo; + UnconditionalFlowInfo actionInfo = flowInfo.nullInfoLessUnconditionalCopy(); // we need to collect the contribution to nulls of the coming paths through the // loop, be they falling through normally or branched to break, continue labels @@ -72,6 +75,14 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl FlowInfo.UNREACHABLE) != 0) { this.continueLabel = null; } + if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) { + initsOnCondition = flowInfo.unconditionalInits(). + addInitializationsFrom( + actionInfo.mergedWith(loopingContext.initsOnContinue)); + } + } + if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) { + this.condition.checkNPE(currentScope, flowContext, initsOnCondition); } /* Reset reach mode, to address following scenario. * final blank; @@ -101,7 +112,11 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl actionInfo.addPotentialNullInfoFrom( condInfo.initsWhenTrue().unconditionalInits())); } - + if (loopingContext.hasEscapingExceptions()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926 + FlowInfo loopbackFlowInfo = flowInfo.copy(); + loopbackFlowInfo.mergedWith(condInfo.initsWhenTrue().unconditionalCopy()); + loopingContext.simulateThrowAfterLoopBack(loopbackFlowInfo); + } // end of loop FlowInfo mergedInfo = FlowInfo.mergedOptimizedBranches( diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java index 87c25cbd4..a9ce3fc52 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java @@ -56,6 +56,9 @@ public class EqualExpression extends BinaryExpression { flowContext.recordUsingNullReference(scope, local, reference, FlowContext.CAN_ONLY_NULL | FlowContext.IN_COMPARISON_NON_NULL, flowInfo); initsWhenTrue.markAsComparedEqualToNonNull(local); // from thereon it is set + if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { + initsWhenTrue.markedAsNullOrNonNullInAssertExpression(local); + } } else { flowContext.recordUsingNullReference(scope, local, reference, FlowContext.CAN_ONLY_NULL | FlowContext.IN_COMPARISON_NULL, flowInfo); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java index 78aecab69..2036f5876 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -137,6 +138,9 @@ public class ExplicitConstructorCall extends Statement implements InvocationSite this.arguments[i] .analyseCode(currentScope, flowContext, flowInfo) .unconditionalInits(); + if ((this.arguments[i].implicitConversion & TypeIds.UNBOXING) != 0) { + this.arguments[i].checkNPE(currentScope, flowContext, flowInfo); + } } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java index b3b492615..b9568ec26 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 292478 - Report potentially null across variable assignment * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -674,8 +675,14 @@ public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInf } flowInfo.markAsComparedEqualToNonNull(local); // from thereon it is set + if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { + flowInfo.markedAsNullOrNonNullInAssertExpression(local); + } if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); + if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { + flowContext.initsOnFinally.markedAsNullOrNonNullInAssertExpression(local); + } } } } @@ -1000,13 +1007,8 @@ public int nullStatus(FlowInfo flowInfo) { return FlowInfo.NON_NULL; // constant expression cannot be null LocalVariableBinding local = localVariableBinding(); - if (local != null) { - if (flowInfo.isDefinitelyNull(local)) - return FlowInfo.NULL; - if (flowInfo.isDefinitelyNonNull(local)) - return FlowInfo.NON_NULL; - return FlowInfo.UNKNOWN; - } + if (local != null) + return flowInfo.nullStatus(local); return FlowInfo.NON_NULL; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java index 643d0b676..1409a4ef3 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java @@ -187,7 +187,10 @@ public void resolve(MethodScope initializationScope) { SourceTypeBinding declaringType = classScope.enclosingSourceType(); checkHidingSuperField: { if (declaringType.superclass == null) break checkHidingSuperField; - FieldBinding existingVariable = classScope.findField(declaringType.superclass, this.name, this, false /*do not resolve hidden field*/); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=318171, find field skipping visibility checks + // we do the checks below ourselves, using the appropriate conditions for access check of + // protected members from superclasses. + FieldBinding existingVariable = classScope.findField(declaringType.superclass, this.name, this, false /*do not resolve hidden field*/, true /* no visibility checks please */); if (existingVariable == null) break checkHidingSuperField; // keep checking outer scenario if (!existingVariable.isValidBinding()) break checkHidingSuperField; // keep checking outer scenario if (existingVariable.original() == this.binding) break checkHidingSuperField; // keep checking outer scenario diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java index da75f04e7..86593c7fe 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Technical University Berlin - extended API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -93,6 +94,9 @@ public class ForStatement extends Statement { new LoopingFlowContext(flowContext, flowInfo, this, null, null, this.scope)), condInfo); + if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) { + this.condition.checkNPE(currentScope, flowContext, flowInfo); + } } } @@ -195,7 +199,13 @@ public class ForStatement extends Statement { incrementContext.complainOnDeferredNullChecks(currentScope, actionInfo); } - + if (loopingContext.hasEscapingExceptions()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926 + FlowInfo loopbackFlowInfo = flowInfo.copy(); + if (this.continueLabel != null) { // we do get to the bottom + loopbackFlowInfo.mergedWith(actionInfo.unconditionalCopy()); + } + loopingContext.simulateThrowAfterLoopBack(loopbackFlowInfo); + } //end of loop FlowInfo mergedInfo = FlowInfo.mergedOptimizedBranches( (loopingContext.initsOnBreak.tagBits & diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java index 4b1ce1ee7..711fde883 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java @@ -423,6 +423,8 @@ public class ForeachStatement extends Statement { if (!this.collectionElementType.isCompatibleWith(elementType) && !this.scope.isBoxingCompatibleWith(this.collectionElementType, elementType)) { this.scope.problemReporter().notCompatibleTypesErrorInForeach(this.collection, this.collectionElementType, elementType); + } else if (this.collectionElementType.needsUncheckedConversion(elementType)) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321085 + this.scope.problemReporter().unsafeTypeConversion(this.collection, collectionType, upperScope.createArrayType(elementType, 1)); } // :giro if (Config.getLoweringRequired()) diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java index d7d557d7c..3e996d61a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -57,6 +58,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl int initialComplaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0 ? Statement.COMPLAINED_FAKE_REACHABLE : Statement.NOT_COMPLAINED; Constant cst = this.condition.optimizedBooleanConstant(); + if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) { + this.condition.checkNPE(currentScope, flowContext, flowInfo); + } boolean isConditionOptimizedTrue = cst != Constant.NotAConstant && cst.booleanValue() == true; boolean isConditionOptimizedFalse = cst != Constant.NotAConstant && cst.booleanValue() == false; @@ -65,7 +69,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl if (isConditionOptimizedFalse) { thenFlowInfo.setReachMode(FlowInfo.UNREACHABLE); } - FlowInfo elseFlowInfo = conditionFlowInfo.initsWhenFalse(); + FlowInfo elseFlowInfo = conditionFlowInfo.initsWhenFalse().copy(); if (isConditionOptimizedTrue) { elseFlowInfo.setReachMode(FlowInfo.UNREACHABLE); } @@ -130,7 +134,8 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl elseFlowInfo, isConditionOptimizedFalse, true /*if(true){ return; } fake-reachable(); */, - flowInfo); + flowInfo, + this); this.mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo); return mergedInfo; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java index 3ce4b9edd..dc2342ad9 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -35,6 +35,8 @@ public class ImportReference extends ASTNode { public int declarationSourceEnd; public int modifiers; // 1.5 addition for static imports public Annotation[] annotations; + // star end position + public int trailingStarPosition; //{ObjectTeams: new queries: public boolean isTeam() { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java index 6fdb60fff..64b7e3e76 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java @@ -69,6 +69,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); + if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { + initsWhenTrue.markedAsNullOrNonNullInAssertExpression(local); + } flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java index a33f082e0..498713f35 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -30,18 +30,6 @@ public IntLiteral(char[] token, int s,int e, int value) { this(token, s,e); this.value = value; } - -public IntLiteral(int intValue) { - //special optimized constructor : the cst is the argument - //value that should not be used - // tokens = null ; - // sourceStart = 0; - // sourceEnd = 0; - super(null,0,0); - this.constant = IntConstant.fromValue(intValue); - this.value = intValue; -} - public void computeConstant() { //a special constant is use for the potential Integer.MAX_VALUE+1 //which is legal if used with a - as prefix....cool.... @@ -133,15 +121,6 @@ public final boolean mayRepresentMIN_VALUE(){ (this.source[9] == '8') && (((this.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT) == 0)); } - -public StringBuffer printExpression(int indent, StringBuffer output){ - if (this.source == null) { - /* special optimized IntLiteral that are created by the compiler */ - return output.append(String.valueOf(this.value)); - } - return super.printExpression(indent, output); -} - public void traverse(ASTVisitor visitor, BlockScope scope) { visitor.visit(this, scope); visitor.endVisit(this, scope); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java index f7e6fafde..f4ea79a2e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -9,6 +9,8 @@ * Contributors: * IBM Corporation - initial API and implementation * Fraunhofer FIRST - extended API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE + * and bug 292478 - Report potentially null across variable assignment * Technical University Berlin - extended API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -83,6 +85,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl if (this.initialization == null) { return flowInfo; } + if ((this.initialization.implicitConversion & TypeIds.UNBOXING) != 0) { + this.initialization.checkNPE(currentScope, flowContext, flowInfo); + } int nullStatus = this.initialization.nullStatus(flowInfo); flowInfo = this.initialization @@ -95,16 +100,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl } flowInfo.markAsDefinitelyAssigned(this.binding); if ((this.binding.type.tagBits & TagBits.IsBaseType) == 0) { - switch(nullStatus) { - case FlowInfo.NULL : - flowInfo.markAsDefinitelyNull(this.binding); - break; - case FlowInfo.NON_NULL : - flowInfo.markAsDefinitelyNonNull(this.binding); - break; - default: - flowInfo.markAsDefinitelyUnknown(this.binding); - } + flowInfo.markNullStatus(this.binding, nullStatus); // no need to inform enclosing try block since its locals won't get // known by the finally block } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java index e9b178809..2fbb5deec 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java @@ -9,6 +9,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752) + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -149,6 +150,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl if (this.arguments != null) { int length = this.arguments.length; for (int i = 0; i < length; i++) { + if ((this.arguments[i].implicitConversion & TypeIds.UNBOXING) != 0) { + this.arguments[i].checkNPE(currentScope, flowContext, flowInfo); + } flowInfo = this.arguments[i].analyseCode(currentScope, flowContext, flowInfo).unconditionalInits(); } } @@ -1075,6 +1079,9 @@ public void setExpectedType(TypeBinding expectedType) { public void setFieldIndex(int depth) { // ignore for here } +public TypeBinding expectedType() { + return this.expectedType; +} public void traverse(ASTVisitor visitor, BlockScope blockScope) { if (visitor.visit(this, blockScope)) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java index 4076d515d..c041fee2a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -62,6 +63,12 @@ public class OR_OR_Expression extends BinaryExpression { } } rightInfo = this.right.analyseCode(currentScope, flowContext, rightInfo); + if ((this.left.implicitConversion & TypeIds.UNBOXING) != 0) { + this.left.checkNPE(currentScope, flowContext, flowInfo); + } + if ((this.right.implicitConversion & TypeIds.UNBOXING) != 0) { + this.right.checkNPE(currentScope, flowContext, flowInfo); + } // The definitely null variables in right info when true should not be missed out while merging // https://bugs.eclipse.org/bugs/show_bug.cgi?id=299900 FlowInfo leftInfoWhenTrueForMerging = leftInfo.initsWhenTrue().unconditionalCopy().addPotentialInitializationsFrom(rightInfo.unconditionalInitsWithoutSideEffect()); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java index d31d14d25..48bea2c79 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -141,6 +142,9 @@ public static abstract class AbstractQualifiedAllocationExpression extends Alloc if (this.arguments != null) { for (int i = 0, count = this.arguments.length; i < count; i++) { flowInfo = this.arguments[i].analyseCode(currentScope, flowContext, flowInfo); + if ((this.arguments[i].implicitConversion & TypeIds.UNBOXING) != 0) { + this.arguments[i].checkNPE(currentScope, flowContext, flowInfo); + } } } @@ -301,6 +305,7 @@ public static abstract class AbstractQualifiedAllocationExpression extends Alloc this.constant = Constant.NotAConstant; TypeBinding enclosingInstanceType = null; + ReferenceBinding enclosingInstanceReference = null; TypeBinding receiverType = null; boolean hasError = false; boolean enclosingInstanceContainsCast = false; @@ -329,6 +334,14 @@ public static abstract class AbstractQualifiedAllocationExpression extends Alloc } else if (this.type instanceof QualifiedTypeReference) { scope.problemReporter().illegalUsageOfQualifiedTypeReference((QualifiedTypeReference)this.type); hasError = true; + } else if (!(enclosingInstanceReference = (ReferenceBinding) enclosingInstanceType).canBeSeenBy(scope)) { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=317212 + enclosingInstanceType = new ProblemReferenceBinding( + enclosingInstanceReference.compoundName, + enclosingInstanceReference, + ProblemReasons.NotVisible); + scope.problemReporter().invalidType(this.enclosingInstance, enclosingInstanceType); + hasError = true; } else { receiverType = ((SingleTypeReference) this.type).resolveTypeEnclosing(scope, (ReferenceBinding) enclosingInstanceType); if (receiverType != null && enclosingInstanceContainsCast) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java index 65651c518..4dd1e12fc 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java @@ -129,7 +129,9 @@ public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowConte } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) { localBinding.useFlag = LocalVariableBinding.FAKE_USED; } - checkNPE(currentScope, flowContext, flowInfo, true); + if (needValue) { + checkNPE(currentScope, flowContext, flowInfo, true); + } } if (needValue) { @@ -226,12 +228,14 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl if (!flowInfo.isDefinitelyAssigned(localBinding = (LocalVariableBinding) this.binding)) { currentScope.problemReporter().uninitializedLocalVariable(localBinding, this); } - if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { + if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) { localBinding.useFlag = LocalVariableBinding.USED; } else if (localBinding.useFlag == LocalVariableBinding.UNUSED) { localBinding.useFlag = LocalVariableBinding.FAKE_USED; } - checkNPE(currentScope, flowContext, flowInfo, true); + if (needValue) { + checkNPE(currentScope, flowContext, flowInfo, true); + } } if (needValue) { manageEnclosingInstanceAccessIfNecessary(currentScope, flowInfo); @@ -250,7 +254,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, boolean checkString) { // cannot override localVariableBinding because this would project o.m onto o when - // analysing assignments + // analyzing assignments if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { LocalVariableBinding local = (LocalVariableBinding) this.binding; if (local != null && @@ -261,9 +265,15 @@ public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInf FlowContext.MAY_NULL, flowInfo); } flowInfo.markAsComparedEqualToNonNull(local); - // from thereon it is set + // from thereon it is set + if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { + flowInfo.markedAsNullOrNonNullInAssertExpression(local); + } if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); + if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { + flowContext.initsOnFinally.markedAsNullOrNonNullInAssertExpression(local); + } } } } @@ -891,6 +901,10 @@ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, Fl if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding; if (localVariableBinding != null) { + if ((localVariableBinding.tagBits & TagBits.NotInitialized) != 0) { + // local was tagged as uninitialized + return; + } switch(localVariableBinding.useFlag) { case LocalVariableBinding.FAKE_USED : case LocalVariableBinding.USED : diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java index 7c8070f81..54f5639d1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java @@ -29,7 +29,7 @@ import org.eclipse.objectteams.otdt.internal.core.compiler.model.TeamModel; * @version $Id: Reference.java 23404 2010-02-03 14:10:22Z stephan $ */ public abstract class Reference extends Expression { -//{ObjectTeams: support expected type +//{ObjectTeams: store expected type to support infering callout-to-field public TypeBinding expectedType; @Override public void setExpectedType(TypeBinding expectedType) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java index 506025edd..c3d2fc346 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE * Technical University Berlin - extended API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -42,6 +43,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl if (this.expression != null) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo); + if ((this.expression.implicitConversion & TypeIds.UNBOXING) != 0) { + this.expression.checkNPE(currentScope, flowContext, flowInfo); + } } this.initStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java index 4662d668e..877f2d5cf 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 292478 - Report potentially null across variable assignment * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -759,6 +760,10 @@ public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, Fl if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding; if (localVariableBinding != null) { + if ((localVariableBinding.tagBits & TagBits.NotInitialized) != 0) { + // local was tagged as uninitialized + return; + } switch(localVariableBinding.useFlag) { case LocalVariableBinding.FAKE_USED : case LocalVariableBinding.USED : @@ -818,13 +823,8 @@ public int nullStatus(FlowInfo flowInfo) { return FlowInfo.UNKNOWN; case Binding.LOCAL : // reading a local variable LocalVariableBinding local = (LocalVariableBinding) this.binding; - if (local != null) { - if (flowInfo.isDefinitelyNull(local)) - return FlowInfo.NULL; - if (flowInfo.isDefinitelyNonNull(local)) - return FlowInfo.NON_NULL; - return FlowInfo.UNKNOWN; - } + if (local != null) + return flowInfo.nullStatus(local); } return FlowInfo.NON_NULL; // never get there } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java index a56af5ba4..629a3365a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java @@ -236,4 +236,12 @@ public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatem resolve(scope); return Constant.NotAConstant; } +/** + * Implementation of {@link org.eclipse.jdt.internal.compiler.lookup.InvocationSite#expectedType} + * suitable at this level. Subclasses should override as necessary. + * @see org.eclipse.jdt.internal.compiler.lookup.InvocationSite#expectedType() + */ +public TypeBinding expectedType() { + return null; +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java index 0d2e13f14..6fbfe22fc 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -45,8 +46,11 @@ public class SwitchStatement extends Statement { int mergedInitStateIndex = -1; public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { - try { + try { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo); + if ((this.expression.implicitConversion & TypeIds.UNBOXING) != 0) { + this.expression.checkNPE(currentScope, flowContext, flowInfo); + } SwitchFlowContext switchContext = new SwitchFlowContext(flowContext, this, (this.breakLabel = new BranchLabel())); @@ -94,8 +98,8 @@ public class SwitchStatement extends Statement { } final TypeBinding resolvedTypeBinding = this.expression.resolvedType; - if (this.caseCount > 0 && resolvedTypeBinding.isEnum()) { - final SourceTypeBinding sourceTypeBinding = this.scope.classScope().referenceContext.binding; + if (resolvedTypeBinding.isEnum()) { + final SourceTypeBinding sourceTypeBinding = currentScope.classScope().referenceContext.binding; this.synthetic = sourceTypeBinding.addSyntheticMethodForSwitchEnum(resolvedTypeBinding); } // if no default case, then record it may jump over the block directly to the end @@ -111,9 +115,9 @@ public class SwitchStatement extends Statement { this.mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo); return mergedInfo; - } finally { - if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block - } + } finally { + if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block + } } /** @@ -124,7 +128,7 @@ public class SwitchStatement extends Statement { */ public void generateCode(BlockScope currentScope, CodeStream codeStream) { - try { + try { if ((this.bits & IsReachable) == 0) { return; } @@ -133,36 +137,37 @@ public class SwitchStatement extends Statement { // prepare the labels and constants this.breakLabel.initialize(codeStream); CaseLabel[] caseLabels = new CaseLabel[this.caseCount]; - boolean needSwitch = this.caseCount != 0; - for (int i = 0; i < this.caseCount; i++) { + for (int i = 0, max = this.caseCount; i < max; i++) { this.cases[i].targetLabel = (caseLabels[i] = new CaseLabel(codeStream)); caseLabels[i].tagBits |= BranchLabel.USED; } CaseLabel defaultLabel = new CaseLabel(codeStream); - if (needSwitch) defaultLabel.tagBits |= BranchLabel.USED; + final boolean hasCases = this.caseCount != 0; + if (hasCases) defaultLabel.tagBits |= BranchLabel.USED; if (this.defaultCase != null) { this.defaultCase.targetLabel = defaultLabel; } final TypeBinding resolvedType = this.expression.resolvedType; + boolean valueRequired = false; if (resolvedType.isEnum()) { - if (needSwitch) { - // go through the translation table - codeStream.invoke(Opcodes.OPC_invokestatic, this.synthetic, null /* default declaringClass */); - this.expression.generateCode(currentScope, codeStream, true); - // get enum constant ordinal() - codeStream.invokeEnumOrdinal(resolvedType.constantPoolName()); - codeStream.iaload(); - } else { - // no need to go through the translation table - this.expression.generateCode(currentScope, codeStream, false); + // go through the translation table + codeStream.invoke(Opcodes.OPC_invokestatic, this.synthetic, null /* default declaringClass */); + this.expression.generateCode(currentScope, codeStream, true); + // get enum constant ordinal() + codeStream.invokeEnumOrdinal(resolvedType.constantPoolName()); + codeStream.iaload(); + if (!hasCases) { + // we can get rid of the generated ordinal value + codeStream.pop(); } } else { + valueRequired = this.expression.constant == Constant.NotAConstant || hasCases; // generate expression - this.expression.generateCode(currentScope, codeStream, needSwitch); // value required (switch without cases) + this.expression.generateCode(currentScope, codeStream, valueRequired); } // generate the appropriate switch table/lookup bytecode - if (needSwitch) { + if (hasCases) { int[] sortedIndexes = new int[this.caseCount]; // we sort the keys to be able to generate the code for tableswitch or lookupswitch for (int i = 0; i < this.caseCount; i++) { @@ -194,6 +199,8 @@ public class SwitchStatement extends Statement { codeStream.lookupswitch(defaultLabel, this.constants, sortedIndexes, caseLabels); } codeStream.updateLastRecordedEndPC(this.scope, codeStream.position); + } else if (valueRequired) { + codeStream.pop(); } // generate the switch block statements @@ -234,9 +241,9 @@ public class SwitchStatement extends Statement { defaultLabel.place(); } codeStream.recordPositionsFrom(pc, this.sourceStart); - } finally { - if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block - } + } finally { + if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block + } } public StringBuffer printStatement(int indent, StringBuffer output) { @@ -258,8 +265,7 @@ public class SwitchStatement extends Statement { } public void resolve(BlockScope upperScope) { - - try { + try { boolean isEnumSwitch = false; TypeBinding expressionType = this.expression.resolveType(upperScope); if (expressionType != null) { @@ -285,7 +291,7 @@ public class SwitchStatement extends Statement { } } if (this.statements != null) { - this.scope = /*explicitDeclarations == 0 ? upperScope : */new BlockScope(upperScope); + this.scope = new BlockScope(upperScope); int length; // collection of cases is too big but we will only iterate until caseCount this.cases = new CaseStatement[length = this.statements.length]; @@ -355,9 +361,9 @@ public class SwitchStatement extends Statement { } } } - } finally { - if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block - } + } finally { + if (this.scope != null) this.scope.enclosingCase = null; // no longer inside switch case block + } } public void traverse( diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java index c727175a0..77e762ce1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java @@ -1909,6 +1909,28 @@ public void resolve(BlockScope blockScope) { ReferenceBinding existingType = (ReferenceBinding) existing; if (existingType instanceof TypeVariableBinding) { blockScope.problemReporter().typeHiding(this, (TypeVariableBinding) existingType); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=312989, check for collision with enclosing type. + Scope outerScope = blockScope.parent; +checkOuterScope:while (outerScope != null) { + Binding existing2 = outerScope.getType(this.name); + if (existing2 instanceof TypeVariableBinding && existing2.isValidBinding()) { + TypeVariableBinding tvb = (TypeVariableBinding) existingType; + Binding declaringElement = tvb.declaringElement; + if (declaringElement instanceof ReferenceBinding + && CharOperation.equals(((ReferenceBinding) declaringElement).sourceName(), this.name)) { + blockScope.problemReporter().typeCollidesWithEnclosingType(this); + break checkOuterScope; + } + } else if (existing2 instanceof ReferenceBinding + && existing2.isValidBinding() + && outerScope.isDefinedInType((ReferenceBinding) existing2)) { + blockScope.problemReporter().typeCollidesWithEnclosingType(this); + break checkOuterScope; + } else if (existing2 == null) { + break checkOuterScope; + } + outerScope = outerScope.parent; + } } else if (existingType instanceof LocalTypeBinding && ((LocalTypeBinding) existingType).scope.methodScope() == blockScope.methodScope()) { // dup in same method diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java index 00db5c9b0..144e64e0d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; @@ -63,6 +64,9 @@ public class WhileStatement extends Statement { new LoopingFlowContext(flowContext, flowInfo, this, null, null, currentScope)), condInfo); + if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) { + this.condition.checkNPE(currentScope, flowContext, flowInfo); + } LoopingFlowContext loopingContext; FlowInfo actionInfo; @@ -137,6 +141,13 @@ public class WhileStatement extends Statement { actionInfo.unconditionalInits()). addInitializationsFrom(condInfo.initsWhenFalse()); } + if (loopingContext.hasEscapingExceptions()) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926 + FlowInfo loopbackFlowInfo = flowInfo.copy(); + if (this.continueLabel != null) { // we do get to the bottom + loopbackFlowInfo.mergedWith(actionInfo.unconditionalCopy()); + } + loopingContext.simulateThrowAfterLoopBack(loopbackFlowInfo); + } } // end of loop diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java index 109bc6658..13f27eebb 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 BEA Systems, Inc. + * Copyright (c) 2005, 2010 BEA Systems, Inc. * 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 @@ -7,15 +7,19 @@ * * Contributors: * tyeung@bea.com - initial API and implementation + * olivier_thomann@ca.ibm.com - add hashCode() and equals(..) methods *******************************************************************************/ package org.eclipse.jdt.internal.compiler.classfmt; +import java.util.Arrays; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; import org.eclipse.jdt.internal.compiler.env.*; import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.util.Util; public class AnnotationInfo extends ClassFileStruct implements IBinaryAnnotation { /** The name of the annotation type */ @@ -376,4 +380,30 @@ public String toString() { } return buffer.toString(); } +public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + Util.hashCode(this.pairs); + result = prime * result + CharOperation.hashCode(this.typename); + return result; +} +public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + AnnotationInfo other = (AnnotationInfo) obj; + if (!Arrays.equals(this.pairs, other.pairs)) { + return false; + } + if (!Arrays.equals(this.typename, other.typename)) { + return false; + } + return true; +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java index 3c81e1968..3a9e1630c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -1153,8 +1153,27 @@ private boolean hasStructuralAnnotationChanges(IBinaryAnnotation[] currentAnnota for (int j = 0; j < currentPairsLength; j++) { if (!CharOperation.equals(currentPairs[j].getName(), otherPairs[j].getName())) return true; - if (!currentPairs[j].getValue().equals(otherPairs[j].getValue())) + final Object value = currentPairs[j].getValue(); + final Object value2 = otherPairs[j].getValue(); + if (value instanceof Object[]) { + Object[] currentValues = (Object[]) value; + if (value2 instanceof Object[]) { + Object[] currentValues2 = (Object[]) value2; + final int length = currentValues.length; + if (length != currentValues2.length) { + return true; + } + for (int n = 0; n < length; n++) { + if (!currentValues[n].equals(currentValues2[n])) { + return true; + } + } + return false; + } + return true; + } else if (!value.equals(value2)) { return true; + } } } return false; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java index 188051bc7..5a40c0d96 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 BEA Systems, Inc. + * Copyright (c) 2005, 2010 BEA Systems, Inc. * 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 @@ -7,9 +7,14 @@ * * Contributors: * tyeung@bea.com - initial API and implementation + * olivier_thomann@ca.ibm.com - add hashCode() and equals(..) methods *******************************************************************************/ package org.eclipse.jdt.internal.compiler.classfmt; +import java.util.Arrays; + +import org.eclipse.jdt.core.compiler.CharOperation; + public class ElementValuePairInfo implements org.eclipse.jdt.internal.compiler.env.IBinaryElementValuePair { static final ElementValuePairInfo[] NoMembers = new ElementValuePairInfo[0]; @@ -45,4 +50,34 @@ public String toString() { } return buffer.toString(); } +public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + CharOperation.hashCode(this.name); + result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); + return result; +} +public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ElementValuePairInfo other = (ElementValuePairInfo) obj; + if (!Arrays.equals(this.name, other.name)) { + return false; + } + if (this.value == null) { + if (other.value != null) { + return false; + } + } else if (!this.value.equals(other.value)) { + return false; + } + return true; +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ClassSignature.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ClassSignature.java index 6c68a09a8..f3e4685f1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ClassSignature.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ClassSignature.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 BEA Systems, Inc. + * Copyright (c) 2005, 2010 BEA Systems, Inc. * 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 @@ -7,9 +7,14 @@ * * Contributors: * tyeung@bea.com - initial API and implementation + * olivier_thomann@ca.ibm.com - add hashCode() and equals(..) methods *******************************************************************************/ package org.eclipse.jdt.internal.compiler.env; +import java.util.Arrays; + +import org.eclipse.jdt.core.compiler.CharOperation; + /** * Represents a class reference in the class file. * One of the possible results for the default value of an annotation method or an element value pair. @@ -35,4 +40,25 @@ public String toString() { buffer.append(".class"); //$NON-NLS-1$ return buffer.toString(); } + +public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + CharOperation.hashCode(this.className); + return result; +} + +public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ClassSignature other = (ClassSignature) obj; + return Arrays.equals(this.className, other.className); +} }
\ No newline at end of file diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/EnumConstantSignature.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/EnumConstantSignature.java index 66a8434ae..437df947b 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/EnumConstantSignature.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/EnumConstantSignature.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 BEA Systems, Inc. + * Copyright (c) 2005, 2010 BEA Systems, Inc. * 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 @@ -7,9 +7,13 @@ * * Contributors: * tyeung@bea.com - initial API and implementation + * olivier_thomann@ca.ibm.com - add hashCode() and equals(..) methods *******************************************************************************/ package org.eclipse.jdt.internal.compiler.env; +import java.util.Arrays; + +import org.eclipse.jdt.core.compiler.CharOperation; /** * Represents a reference to a enum constant in the class file. * One of the possible results for the default value of an annotation method. @@ -45,4 +49,29 @@ public String toString() { buffer.append(this.constName); return buffer.toString(); } + +public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + CharOperation.hashCode(this.constName); + result = prime * result + CharOperation.hashCode(this.typeName); + return result; +} + +public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + EnumConstantSignature other = (EnumConstantSignature) obj; + if (!Arrays.equals(this.constName, other.constName)) { + return false; + } + return Arrays.equals(this.typeName, other.typeName); +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java index 3470fa7d6..bb0e2a6db 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java @@ -157,11 +157,31 @@ public void markAsDefinitelyNull(LocalVariableBinding local) { this.initsWhenFalse.markAsDefinitelyNull(local); } +public void resetNullInfo(LocalVariableBinding local) { + this.initsWhenTrue.resetNullInfo(local); + this.initsWhenFalse.resetNullInfo(local); +} + +public void markPotentiallyNullBit(LocalVariableBinding local) { + this.initsWhenTrue.markPotentiallyNullBit(local); + this.initsWhenFalse.markPotentiallyNullBit(local); +} + +public void markPotentiallyNonNullBit(LocalVariableBinding local) { + this.initsWhenTrue.markPotentiallyNonNullBit(local); + this.initsWhenFalse.markPotentiallyNonNullBit(local); +} + public void markAsDefinitelyUnknown(LocalVariableBinding local) { this.initsWhenTrue.markAsDefinitelyUnknown(local); this.initsWhenFalse.markAsDefinitelyUnknown(local); } +public void markPotentiallyUnknownBit(LocalVariableBinding local) { + this.initsWhenTrue.markPotentiallyUnknownBit(local); + this.initsWhenFalse.markPotentiallyUnknownBit(local); +} + public FlowInfo setReachMode(int reachMode) { if (reachMode == REACHABLE) { this.tagBits &= ~UNREACHABLE; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java index 7e0421137..369d24ed2 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.flow; +import java.util.ArrayList; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.ASTNode; @@ -92,6 +93,7 @@ public void checkExceptionHandlers(TypeBinding raisedException, ASTNode location // all related catch blocks are marked as reachable... instead of those only // until the point where it is safely handled (Smarter - see comment at the end) FlowContext traversedContext = this; + ArrayList abruptlyExitedLoops = null; while (traversedContext != null) { SubRoutineStatement sub; if (((sub = traversedContext.subroutine()) != null) && sub.isSubRoutineEscaping()) { @@ -115,6 +117,12 @@ public void checkExceptionHandlers(TypeBinding raisedException, ASTNode location int state = caughtException == null ? Scope.EQUAL_OR_MORE_SPECIFIC /* any exception */ : Scope.compareTypes(raisedException, caughtException); + if (abruptlyExitedLoops != null && caughtException != null && state != Scope.NOT_RELATED) { + for (int i = 0, abruptlyExitedLoopsCount = abruptlyExitedLoops.size(); i < abruptlyExitedLoopsCount; i++) { + LoopingFlowContext loop = (LoopingFlowContext) abruptlyExitedLoops.get(i); + loop.recordCatchContextOfEscapingException(exceptionContext, caughtException); + } + } switch (state) { case Scope.EQUAL_OR_MORE_SPECIFIC : exceptionContext.recordHandlingException( @@ -156,6 +164,11 @@ public void checkExceptionHandlers(TypeBinding raisedException, ASTNode location } break; // not handled anywhere, thus jump to error handling } + } else if (traversedContext instanceof LoopingFlowContext) { + if (abruptlyExitedLoops == null) { + abruptlyExitedLoops = new ArrayList(5); + } + abruptlyExitedLoops.add(traversedContext); } traversedContext.recordReturnFrom(flowInfo.unconditionalInits()); @@ -195,6 +208,7 @@ public void checkExceptionHandlers(TypeBinding[] raisedExceptions, ASTNode locat raisedCount); FlowContext traversedContext = this; + ArrayList abruptlyExitedLoops = null; while (traversedContext != null) { SubRoutineStatement sub; if (((sub = traversedContext.subroutine()) != null) && sub.isSubRoutineEscaping()) { @@ -220,6 +234,12 @@ public void checkExceptionHandlers(TypeBinding[] raisedExceptions, ASTNode locat int state = caughtException == null ? Scope.EQUAL_OR_MORE_SPECIFIC /* any exception */ : Scope.compareTypes(raisedException, caughtException); + if (abruptlyExitedLoops != null && caughtException != null && state != Scope.NOT_RELATED) { + for (int i = 0, abruptlyExitedLoopsCount = abruptlyExitedLoops.size(); i < abruptlyExitedLoopsCount; i++) { + LoopingFlowContext loop = (LoopingFlowContext) abruptlyExitedLoops.get(i); + loop.recordCatchContextOfEscapingException(exceptionContext, caughtException); + } + } switch (state) { case Scope.EQUAL_OR_MORE_SPECIFIC : exceptionContext.recordHandlingException( @@ -282,6 +302,11 @@ public void checkExceptionHandlers(TypeBinding[] raisedExceptions, ASTNode locat } break; // not handled anywhere, thus jump to error handling } + } else if (traversedContext instanceof LoopingFlowContext) { + if (abruptlyExitedLoops == null) { + abruptlyExitedLoops = new ArrayList(5); + } + abruptlyExitedLoops.add(traversedContext); } if (remainingCount == 0) return; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java index 4a1005d30..0f5b81800 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java @@ -8,11 +8,14 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 292478 - Report potentially null across variable assignment * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.compiler.flow; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.IfStatement; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; import org.eclipse.objectteams.otdt.internal.core.compiler.ast.BaseCallTrackingVariable; @@ -34,9 +37,12 @@ public abstract class FlowInfo { public final static int UNREACHABLE = 1; public final static int NULL_FLAG_MASK = 2; - public final static int UNKNOWN = 0; - public final static int NULL = 1; - public final static int NON_NULL = -1; + public final static int UNKNOWN = 1; + public final static int NULL = 2; + public final static int NON_NULL = 4; + public final static int POTENTIALLY_UNKNOWN = 8; + public final static int POTENTIALLY_NULL = 16; + public final static int POTENTIALLY_NON_NULL = 32; public static final UnconditionalFlowInfo DEAD_END; // Represents a dead branch status of initialization static { @@ -260,6 +266,26 @@ abstract public void markAsComparedEqualToNull(LocalVariableBinding local); abstract public void markAsDefinitelyNull(LocalVariableBinding local); /** + * Reset all null-information about a given local. + */ + abstract public void resetNullInfo(LocalVariableBinding local); + + /** + * Record a local may have got assigned to unknown (set the bit on existing info). + */ + abstract public void markPotentiallyUnknownBit(LocalVariableBinding local); + + /** + * Record a local may have got assigned to null (set the bit on existing info). + */ + abstract public void markPotentiallyNullBit(LocalVariableBinding local); + + /** + * Record a local may have got assigned to non-null (set the bit on existing info). + */ + abstract public void markPotentiallyNonNullBit(LocalVariableBinding local); + + /** * Record a local got definitely assigned. */ abstract public void markAsDefinitelyAssigned(LocalVariableBinding local); @@ -270,6 +296,61 @@ abstract public void markAsComparedEqualToNull(LocalVariableBinding local); abstract public void markAsDefinitelyUnknown(LocalVariableBinding local); /** + * Mark the null status of the given local according to the given status + * @param local + * @param nullStatus bitset of FLowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL + */ +public void markNullStatus(LocalVariableBinding local, int nullStatus) { + switch(nullStatus) { + // definite status? + case FlowInfo.UNKNOWN : + markAsDefinitelyUnknown(local); + break; + case FlowInfo.NULL : + markAsDefinitelyNull(local); + break; + case FlowInfo.NON_NULL : + markAsDefinitelyNonNull(local); + break; + default: + // collect potential status: + resetNullInfo(local); + if ((nullStatus & FlowInfo.POTENTIALLY_UNKNOWN) != 0) + markPotentiallyUnknownBit(local); + if ((nullStatus & FlowInfo.POTENTIALLY_NULL) != 0) + markPotentiallyNullBit(local); + if ((nullStatus & FlowInfo.POTENTIALLY_NON_NULL) != 0) + markPotentiallyNonNullBit(local); + if ((nullStatus & (FlowInfo.POTENTIALLY_NULL|FlowInfo.POTENTIALLY_NON_NULL|FlowInfo.POTENTIALLY_UNKNOWN)) == 0) + markAsDefinitelyUnknown(local); + } +} + +/** + * Answer the null status of the given local + * @param local + * @return bitset of FlowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL + */ +public int nullStatus(LocalVariableBinding local) { + if (isDefinitelyUnknown(local)) + return FlowInfo.UNKNOWN; + if (isDefinitelyNull(local)) + return FlowInfo.NULL; + if (isDefinitelyNonNull(local)) + return FlowInfo.NON_NULL; + int status = 0; + if (isPotentiallyUnknown(local)) + status |= FlowInfo.POTENTIALLY_UNKNOWN; + if (isPotentiallyNull(local)) + status |= FlowInfo.POTENTIALLY_NULL; + if (isPotentiallyNonNull(local)) + status |= FlowInfo.POTENTIALLY_NON_NULL; + if (status > 0) + return status; + return FlowInfo.UNKNOWN; +} + +/** * Merge branches using optimized boolean conditions */ public static UnconditionalFlowInfo mergedOptimizedBranches( @@ -314,7 +395,7 @@ public static UnconditionalFlowInfo mergedOptimizedBranches( public static UnconditionalFlowInfo mergedOptimizedBranchesIfElse( FlowInfo initsWhenTrue, boolean isOptimizedTrue, FlowInfo initsWhenFalse, boolean isOptimizedFalse, - boolean allowFakeDeadBranch, FlowInfo flowInfo) { + boolean allowFakeDeadBranch, FlowInfo flowInfo, IfStatement ifStatement) { UnconditionalFlowInfo mergedInfo; if (isOptimizedTrue){ if (initsWhenTrue == FlowInfo.DEAD_END && allowFakeDeadBranch) { @@ -341,7 +422,7 @@ public static UnconditionalFlowInfo mergedOptimizedBranchesIfElse( } } else if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0 && - (initsWhenFalse.tagBits & FlowInfo.UNREACHABLE) != 0 && + (ifStatement.bits & ASTNode.IsElseStatementUnreachable) != 0 && initsWhenTrue != FlowInfo.DEAD_END && initsWhenFalse != FlowInfo.DEAD_END) { // Done when the then branch will always be executed but the condition does not have a boolean @@ -358,7 +439,7 @@ public static UnconditionalFlowInfo mergedOptimizedBranchesIfElse( } else if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0 && - (initsWhenTrue.tagBits & FlowInfo.UNREACHABLE) != 0 && initsWhenTrue != FlowInfo.DEAD_END + (ifStatement.bits & ASTNode.IsThenStatementUnreachable) != 0 && initsWhenTrue != FlowInfo.DEAD_END && initsWhenFalse != FlowInfo.DEAD_END) { // Done when the else branch will always be executed but the condition does not have a boolean // true or false (i.e if(true), etc) for sure diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java index 8b02bc736..69fe5754c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.flow; +import java.util.ArrayList; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.Reference; @@ -17,6 +18,7 @@ import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.Scope; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; @@ -45,6 +47,23 @@ public class LoopingFlowContext extends SwitchFlowContext { int[] nullCheckTypes; int nullCount; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926 + static private class EscapingExceptionCatchSite { + final ReferenceBinding caughtException; + final ExceptionHandlingFlowContext catchingContext; + public EscapingExceptionCatchSite(ExceptionHandlingFlowContext catchingContext, ReferenceBinding caughtException) { + this.catchingContext = catchingContext; + this.caughtException = caughtException; + } + void simulateThrowAfterLoopBack(FlowInfo flowInfo) { + this.catchingContext.recordHandlingException(this.caughtException, + flowInfo.unconditionalInits(), null, // raised exception, irrelevant here + null, /* invocation site, irrelevant here */ true // we have no business altering the needed status. + ); + } + } + private ArrayList escapingExceptionCatchSites = null; + Scope associatedScope; public LoopingFlowContext( @@ -608,4 +627,31 @@ public void recordUsingNullReference(Scope scope, LocalVariableBinding local, } } } + + /* Simulate a throw of an exception from inside a loop in its second or subsequent iteration. + See https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926 + */ + public void simulateThrowAfterLoopBack(FlowInfo flowInfo) { + if (this.escapingExceptionCatchSites != null) { + for (int i = 0, exceptionCount = this.escapingExceptionCatchSites.size(); i < exceptionCount; i++) { + ((EscapingExceptionCatchSite) this.escapingExceptionCatchSites.get(i)).simulateThrowAfterLoopBack(flowInfo); + } + this.escapingExceptionCatchSites = null; // don't care for it anymore. + } + } + + /* Record the fact that some exception thrown by code within this loop + is caught by an outer catch block. This is used to propagate data flow + along the edge back to the next iteration. See simulateThrowAfterLoopBack + */ + public void recordCatchContextOfEscapingException(ExceptionHandlingFlowContext catchingContext, ReferenceBinding caughtException) { + if (this.escapingExceptionCatchSites == null) { + this.escapingExceptionCatchSites = new ArrayList(5); + } + this.escapingExceptionCatchSites.add(new EscapingExceptionCatchSite(catchingContext, caughtException)); + } + + public boolean hasEscapingExceptions() { + return this.escapingExceptionCatchSites != null; + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java index 775799dd1..40efcbf8a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. + * Copyright (c) 2006, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 320170 *******************************************************************************/ package org.eclipse.jdt.internal.compiler.flow; @@ -319,7 +320,7 @@ public UnconditionalFlowInfo mitigateNullInfoOf(FlowInfo flowInfo) { // prot. non null & ((a2 = this.nullBit2) | (a4 = this.nullBit4)); // null or unknown - m2 = s1 & (s2 = this.nullBit2) & (s3 ^ s4) + m2 = s1 & (s2 = this.nullBit2) & (s3 ^ s4) // TODO(stephan): potential typo: should this be "s2 = source.nullBit2"??? // prot. null & ((a3 = this.nullBit3) | a4); // non null or unknown @@ -336,6 +337,18 @@ public UnconditionalFlowInfo mitigateNullInfoOf(FlowInfo flowInfo) { source.nullBit2 &= (nm1 = ~m1) & ((nm2 = ~m2) | a4); source.nullBit3 &= (nm1 | a2) & nm2; source.nullBit4 &= nm1 & nm2; + // any variable that is (pot n, pot nn, pot un) at end of try (as captured by *this* NullInfoRegistry) + // has the same uncertainty also for the mitigated case (function result) + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=320170 - [compiler] [null] Whitebox issues in null analysis + // and org.eclipse.jdt.core.tests.compiler.regression.NullReferenceTest.test0536_try_finally() + long x = ~this.nullBit1 & a2 & a3 & a4; // x is set for all variable ids that have state 0111 (pot n, pot nn, pot un) + if (x != 0) { + // restore state 0111 for all variable ids in x: + source.nullBit1 &= ~x; + source.nullBit2 |= x; + source.nullBit3 |= x; + source.nullBit4 |= x; + } } if (this.extra != null && source.extra != null) { int length = this.extra[2].length, sourceLength = source.extra[0].length; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java index f2006baf7..4146e5a93 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bugs 325755, 320170 and 292478 * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -34,10 +35,8 @@ import org.eclipse.objectteams.otdt.internal.core.compiler.ast.BaseCallTrackingV * No caching of pre-allocated instances. */ public class UnconditionalFlowInfo extends FlowInfo { - // Coverage tests /** - * Exception raised when unexpected behavior is detected during coverage - * tests. + * Exception raised when unexpected behavior is detected. */ public static class AssertionFailedException extends RuntimeException { private static final long serialVersionUID = 1827352841030089703L; @@ -74,6 +73,7 @@ public class UnconditionalFlowInfo extends FlowInfo { 0100 pot. null 0101 pot. n & pot. un 0110 pot. n & pot. nn + 0111 pot. n & pot. nn & pot. un 1001 def. unknown 1010 def. non null 1011 pot. nn & prot. nn @@ -996,7 +996,20 @@ final public boolean isProtectedNull(LocalVariableBinding local) { & (this.extra[4][vectorIndex] ^ this.extra[5][vectorIndex]) & (1L << (position % BitCacheSize))) != 0; } - +/** Asserts that the given boolean is <code>true</code>. If this + * is not the case, some kind of unchecked exception is thrown. + * The given message is included in that exception, to aid debugging. + * + * @param expression the outcome of the check + * @param message the message to include in the exception + * @return <code>true</code> if the check passes (does not return + * if the check fails) + */ +private static boolean isTrue(boolean expression, String message) { + if (!expression) + throw new AssertionFailedException("assertion failed: " + message); //$NON-NLS-1$ + return expression; +} public void markAsComparedEqualToNonNull(LocalVariableBinding local) { // protected from non-object locals in calling methods if (this != DEAD_END) { @@ -1350,6 +1363,124 @@ public void markAsDefinitelyUnknown(LocalVariableBinding local) { } } +public void resetNullInfo(LocalVariableBinding local) { + if (this != DEAD_END) { + this.tagBits |= NULL_FLAG_MASK; + int position; + long mask; + if ((position = local.id + this.maxFieldCount) < BitCacheSize) { + // use bits + this.nullBit1 &= (mask = ~(1L << position)); + this.nullBit2 &= mask; + this.nullBit3 &= mask; + this.nullBit4 &= mask; + } else { + // use extra vector + int vectorIndex ; + this.extra[2][vectorIndex = (position / BitCacheSize) - 1] + &= (mask = ~(1L << (position % BitCacheSize))); + this.extra[3][vectorIndex] &= mask; + this.extra[4][vectorIndex] &= mask; + this.extra[5][vectorIndex] &= mask; + } + } +} + +/** + * Mark a local as potentially having been assigned to an unknown value. + * @param local the local to mark + */ +public void markPotentiallyUnknownBit(LocalVariableBinding local) { + // protected from non-object locals in calling methods + if (this != DEAD_END) { + this.tagBits |= NULL_FLAG_MASK; + int position; + long mask; + if ((position = local.id + this.maxFieldCount) < BitCacheSize) { + // use bits + mask = 1L << position; + isTrue((this.nullBit1 & mask) == 0, "Adding 'unknown' mark in unexpected state"); //$NON-NLS-1$ + this.nullBit4 |= mask; + if (COVERAGE_TEST_FLAG) { + if(CoverageTestId == 46) { + this.nullBit4 = ~0; + } + } + } else { + // use extra vector + int vectorIndex = (position / BitCacheSize) - 1; + mask = 1L << (position % BitCacheSize); + isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'unknown' mark in unexpected state"); //$NON-NLS-1$ + this.extra[5][vectorIndex] |= mask; + if (COVERAGE_TEST_FLAG) { + if(CoverageTestId == 47) { + this.extra[5][vectorIndex] = ~0; + } + } + } + } +} + +public void markPotentiallyNullBit(LocalVariableBinding local) { + if (this != DEAD_END) { + this.tagBits |= NULL_FLAG_MASK; + int position; + long mask; + if ((position = local.id + this.maxFieldCount) < BitCacheSize) { + // use bits + mask = 1L << position; + isTrue((this.nullBit1 & mask) == 0, "Adding 'potentially null' mark in unexpected state"); //$NON-NLS-1$ + this.nullBit2 |= mask; + if (COVERAGE_TEST_FLAG) { + if(CoverageTestId == 40) { + this.nullBit4 = ~0; + } + } + } else { + // use extra vector + int vectorIndex = (position / BitCacheSize) - 1; + mask = 1L << (position % BitCacheSize); + this.extra[3][vectorIndex] |= mask; + isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'potentially null' mark in unexpected state"); //$NON-NLS-1$ + if (COVERAGE_TEST_FLAG) { + if(CoverageTestId == 41) { + this.extra[5][vectorIndex] = ~0; + } + } + } + } +} + +public void markPotentiallyNonNullBit(LocalVariableBinding local) { + if (this != DEAD_END) { + this.tagBits |= NULL_FLAG_MASK; + int position; + long mask; + if ((position = local.id + this.maxFieldCount) < BitCacheSize) { + // use bits + mask = 1L << position; + isTrue((this.nullBit1 & mask) == 0, "Adding 'potentially non-null' mark in unexpected state"); //$NON-NLS-1$ + this.nullBit3 |= mask; + if (COVERAGE_TEST_FLAG) { + if(CoverageTestId == 42) { + this.nullBit4 = ~0; + } + } + } else { + // use extra vector + int vectorIndex = (position / BitCacheSize) - 1; + mask = 1L << (position % BitCacheSize); + isTrue((this.extra[2][vectorIndex] & mask) == 0, "Adding 'potentially non-null' mark in unexpected state"); //$NON-NLS-1$ + this.extra[4][vectorIndex] |= mask; + if (COVERAGE_TEST_FLAG) { + if(CoverageTestId == 43) { + this.extra[5][vectorIndex] = ~0; + } + } + } + } +} + public UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits) { if ((otherInits.tagBits & UNREACHABLE) != 0 && this != DEAD_END) { if (COVERAGE_TEST_FLAG) { @@ -1411,6 +1542,18 @@ public UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits) { | na2 & (nb3 | nb2)) | na2 & b3 & b4 | a2 & (nb1 & b4 | a3 & na4 & b1) & nb3); + // the above formulae do not handle the state 0111, do it now explicitly: + long ax = ~a1 & a2 & a3 & a4; + long bx = ~b1 & b2 & b3 & b4; + long x = ax|bx; + if (x != 0) { + // restore state 0111 for all variable ids in x: + this.nullBit1 &= ~x; + this.nullBit2 |= x; + this.nullBit3 |= x; + this.nullBit4 |= x; + } + if (COVERAGE_TEST_FLAG) { if(CoverageTestId == 30) { this.nullBit4 = ~0; @@ -1555,6 +1698,17 @@ public UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits) { | na2 & (nb3 | nb2)) | na2 & b3 & b4 | a2 & (nb1 & b4 | a3 & na4 & b1) & nb3); + // the above formulae do not handle the state 0111, do it now explicitly: + long ax = ~a1 & a2 & a3 & a4; + long bx = ~b1 & b2 & b3 & b4; + long x = ax|bx; + if (x != 0) { + // restore state 0111 for all variable ids in x: + this.extra[2][i] &= ~x; + this.extra[3][i] |= x; + this.extra[4][i] |= x; + this.extra[5][i] |= x; + } thisHasNulls = thisHasNulls || this.extra[3][i] != 0 || this.extra[4][i] != 0 || diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java index af70d44bc..ab8d63216 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -17,7 +17,7 @@ public class BooleanConstant extends Constant { private static final BooleanConstant TRUE = new BooleanConstant(true); private static final BooleanConstant FALSE = new BooleanConstant(false); - public static BooleanConstant fromValue(boolean value) { + public static Constant fromValue(boolean value) { return value ? BooleanConstant.TRUE : BooleanConstant.FALSE; } @@ -41,4 +41,22 @@ public class BooleanConstant extends Constant { public int typeID() { return T_boolean; } + + public int hashCode() { + return this.value ? 1231 : 1237; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + // cannot be true anymore as the first test would have returned true + return false; + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java index 28de82b49..f5639620d 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -62,4 +62,22 @@ public class ByteConstant extends Constant { public int typeID() { return T_byte; } + + public int hashCode() { + return this.value; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ByteConstant other = (ByteConstant) obj; + return this.value == other.value; + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java index 538315e55..6f740d621 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -62,4 +62,22 @@ public class CharConstant extends Constant { public int typeID() { return T_char; } + + public int hashCode() { + return this.value; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + CharConstant other = (CharConstant) obj; + return this.value == other.value; + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java index 9f8de4319..d71dac560 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java @@ -350,11 +350,21 @@ public class CompilerOptions { /** Classfile debug information, may contain source file name, line numbers, local variable tables, etc... */ public int produceDebugAttributes; - /** Compliance level for the compiler, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */ + /** Compliance level for the compiler, refers to a JDK version, e.g. {@link ClassFileConstants#JDK1_4} */ public long complianceLevel; - /** Java source level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */ + /** Original compliance level for the compiler, refers to a JDK version, e.g. {@link ClassFileConstants#JDK1_4}, + * Usually same as the field complianceLevel, though the latter could deviate to create temporary sandbox + * modes during reconcile operations. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 + */ + public long originalComplianceLevel; + /** Java source level, refers to a JDK version, e.g. {@link ClassFileConstants#JDK1_4} */ public long sourceLevel; - /** VM target level, refers to a JDK version, e.g. {link {@link ClassFileConstants#JDK1_4} */ + /** Original Java source level, refers to a JDK version, e.g. {@link ClassFileConstants#JDK1_4} + * Usually same as the field sourceLevel, though the latter could deviate to create temporary sandbox + * modes during reconcile operations. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 + * */ + public long originalSourceLevel; + /** VM target level, refers to a JDK version, e.g. {@link ClassFileConstants#JDK1_4} */ public long targetJDK; /** Source encoding format */ public String defaultEncoding; @@ -1261,8 +1271,8 @@ public class CompilerOptions { // by default only lines and source attributes are generated. this.produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES; - this.complianceLevel = ClassFileConstants.JDK1_4; // by default be compliant with 1.4 - this.sourceLevel = ClassFileConstants.JDK1_3; //1.3 source behavior by default + this.complianceLevel = this.originalComplianceLevel = ClassFileConstants.JDK1_4; // by default be compliant with 1.4 + this.sourceLevel = this.originalSourceLevel = ClassFileConstants.JDK1_3; //1.3 source behavior by default this.targetJDK = ClassFileConstants.JDK1_2; // default generates for JVM1.2 this.defaultEncoding = null; // will use the platform default encoding @@ -1425,11 +1435,11 @@ public class CompilerOptions { } if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) { long level = versionToJdkLevel(optionValue); - if (level != 0) this.complianceLevel = level; + if (level != 0) this.complianceLevel = this.originalComplianceLevel = level; } if ((optionValue = optionsMap.get(OPTION_Source)) != null) { long level = versionToJdkLevel(optionValue); - if (level != 0) this.sourceLevel = level; + if (level != 0) this.sourceLevel = this.originalSourceLevel = level; } if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) { long level = versionToJdkLevel(optionValue); diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java index df123b831..92973d278 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -1535,7 +1535,6 @@ public abstract class Constant implements TypeIds, OperatorIds { case T_boolean : return "boolean"; //$NON-NLS-1$ case T_long : return "long";//$NON-NLS-1$ case T_JavaLangString : return "java.lang.String"; //$NON-NLS-1$ - case T_null : return "null"; //$NON-NLS-1$ default: return "unknown"; //$NON-NLS-1$ } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java index a163d8125..ef841cb4b 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -63,4 +63,23 @@ public class DoubleConstant extends Constant { public int typeID() { return T_double; } + + public int hashCode() { + long temp = Double.doubleToLongBits(this.value); + return (int) (temp ^ (temp >>> 32)); + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + DoubleConstant other = (DoubleConstant) obj; + return Double.doubleToLongBits(this.value) == Double.doubleToLongBits(other.value); + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java index 8a2b9c659..41ced2df8 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -61,4 +61,22 @@ public class FloatConstant extends Constant { public int typeID() { return T_float; } + + public int hashCode() { + return Float.floatToIntBits(this.value); + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + FloatConstant other = (FloatConstant) obj; + return Float.floatToIntBits(this.value) == Float.floatToIntBits(other.value); + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java index 8464934a9..01fb04a4e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -97,4 +97,22 @@ public class IntConstant extends Constant { public int typeID() { return T_int; } + + public int hashCode() { + return this.value; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + IntConstant other = (IntConstant) obj; + return this.value == other.value; + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java index 296ccc832..d7b7257b9 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -71,4 +71,22 @@ public String toString(){ public int typeID() { return T_long; } + +public int hashCode() { + return (int) (this.value ^ (this.value >>> 32)); +} + +public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + LongConstant other = (LongConstant) obj; + return this.value == other.value; +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java index 378ce61ff..051e0fa23 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -63,4 +63,22 @@ public class ShortConstant extends Constant { public int typeID() { return T_short; } + + public int hashCode() { + return this.value; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ShortConstant other = (ShortConstant) obj; + return this.value == other.value; + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java index adf91580c..37d493f2f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -39,4 +39,29 @@ public class StringConstant extends Constant { public int typeID() { return T_JavaLangString; } + + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.value == null) ? 0 : this.value.hashCode()); + return result; + } + + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + StringConstant other = (StringConstant) obj; + if (this.value == null) { + return other.value == null; + } else { + return this.value.equals(other.value); + } + } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java index f67677d7b..4c9263f13 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -267,7 +267,7 @@ public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, this.fPackage = packageBinding; this.fileName = binaryType.getFileName(); - char[] typeSignature = environment.globalOptions.sourceLevel >= ClassFileConstants.JDK1_5 ? binaryType.getGenericSignature() : null; + char[] typeSignature = environment.globalOptions.originalSourceLevel >= ClassFileConstants.JDK1_5 ? binaryType.getGenericSignature() : null; this.typeVariables = typeSignature != null && typeSignature.length > 0 && typeSignature[0] == '<' ? null // is initialized in cachePartsFrom (called from LookupEnvironment.createBinaryTypeFrom())... must set to null so isGenericType() answers true : Binding.NO_TYPE_VARIABLES; @@ -418,7 +418,7 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) { } } - long sourceLevel = this.environment.globalOptions.sourceLevel; + long sourceLevel = this.environment.globalOptions.originalSourceLevel; char[] typeSignature = null; if (sourceLevel >= ClassFileConstants.JDK1_5) { typeSignature = binaryType.getGenericSignature(); @@ -853,7 +853,7 @@ private void createMethods(IBinaryMethod[] iMethods, long sourceLevel, char[][][ if (iMethods != null) { total = initialTotal = iMethods.length; boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5 - && this.environment.globalOptions.complianceLevel >= ClassFileConstants.JDK1_5; + && this.environment.globalOptions.originalComplianceLevel >= ClassFileConstants.JDK1_5; for (int i = total; --i >= 0;) { IBinaryMethod method = iMethods[i]; if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java index d45a9c201..d41384767 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java @@ -111,6 +111,9 @@ public abstract class Binding { public final boolean isValidBinding() { return problemId() == ProblemReasons.NoError; } + public boolean isVolatile() { + return false; + } /* API * Answer the problem id associated with the receiver. * NoError if the receiver is a valid binding. diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java index bcaa13f07..4bde24ef6 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java @@ -576,22 +576,31 @@ private Binding internalGetBinding(char[][] compoundName, int mask, InvocationSi problemReporter().deprecatedType(referenceBinding, invocationNode); } } + Binding problemFieldBinding = null; while (currentIndex < length) { referenceBinding = (ReferenceBinding) binding; char[] nextName = compoundName[currentIndex++]; invocationSite.setFieldIndex(currentIndex); invocationSite.setActualReceiverType(referenceBinding); if ((mask & Binding.FIELD) != 0 && (binding = findField(referenceBinding, nextName, invocationSite, true /*resolve*/)) != null) { - if (!binding.isValidBinding()) { - return new ProblemFieldBinding( - ((ProblemFieldBinding)binding).closestMatch, - ((ProblemFieldBinding)binding).declaringClass, - CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'), - binding.problemId()); + if (binding.isValidBinding()) { + break; // binding is now a field + } + problemFieldBinding = new ProblemFieldBinding( + ((ProblemFieldBinding)binding).closestMatch, + ((ProblemFieldBinding)binding).declaringClass, + CharOperation.concatWith(CharOperation.subarray(compoundName, 0, currentIndex), '.'), + binding.problemId()); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=317858 : If field is inaccessible, + // don't give up yet, continue to look for a visible member type + if (binding.problemId() != ProblemReasons.NotVisible) { + return problemFieldBinding; } - break; // binding is now a field } if ((binding = findMemberType(nextName, referenceBinding)) == null) { + if (problemFieldBinding != null) { + return problemFieldBinding; + } if ((mask & Binding.FIELD) != 0) { return new ProblemFieldBinding( null, @@ -610,11 +619,15 @@ private Binding internalGetBinding(char[][] compoundName, int mask, InvocationSi ProblemReasons.NotFound); } // binding is a ReferenceBinding - if (!binding.isValidBinding()) + if (!binding.isValidBinding()) { + if (problemFieldBinding != null) { + return problemFieldBinding; + } return new ProblemReferenceBinding( CharOperation.subarray(compoundName, 0, currentIndex), (ReferenceBinding)((ReferenceBinding)binding).closestMatch(), binding.problemId()); + } if (invocationSite instanceof ASTNode) { referenceBinding = (ReferenceBinding) binding; ASTNode invocationNode = (ASTNode) invocationSite; @@ -1022,7 +1035,7 @@ public final boolean needBlankFinalFieldInitializationCheck(FieldBinding binding * to abort. */ public ProblemReporter problemReporter() { - return outerMostMethodScope().problemReporter(); + return methodScope().problemReporter(); } /* diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java index e7f186551..b4cb96022 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java @@ -16,6 +16,7 @@ package org.eclipse.jdt.internal.compiler.lookup; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.Map; import org.eclipse.jdt.core.compiler.CharOperation; @@ -140,7 +141,7 @@ public class ClassScope extends Scope { } void buildAnonymousTypeBinding(SourceTypeBinding enclosingType, ReferenceBinding supertype) { - LocalTypeBinding anonymousType = buildLocalType(enclosingType, supertype, enclosingType.fPackage); + LocalTypeBinding anonymousType = buildLocalType(enclosingType, enclosingType.fPackage); anonymousType.modifiers |= ExtraCompilerModifiers.AccLocallyUsed; // tag all anonymous types as used locally if (supertype.isInterface()) { anonymousType.superclass = getJavaLangObject(); @@ -232,8 +233,8 @@ public class ClassScope extends Scope { for (int i = 0; i < size; i++) { FieldDeclaration field = fields[i]; if (field.getKind() == AbstractVariableDeclaration.INITIALIZER) { - if (sourceType.isInterface()) - problemReporter().interfaceCannotHaveInitializers(sourceType, field); + // We used to report an error for initializers declared inside interfaces, but + // now this error reporting is moved into the parser itself. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=212713 } else { FieldBinding fieldBinding = new FieldBinding(field, null, field.modifiers | ExtraCompilerModifiers.AccUnresolved, sourceType); fieldBinding.id = count; @@ -334,14 +335,14 @@ public class ClassScope extends Scope { // SH} } - private LocalTypeBinding buildLocalType(SourceTypeBinding enclosingType, ReferenceBinding anonymousOriginalSuperType, PackageBinding packageBinding) { + private LocalTypeBinding buildLocalType(SourceTypeBinding enclosingType, PackageBinding packageBinding) { this.referenceContext.scope = this; this.referenceContext.staticInitializerScope = new MethodScope(this, this.referenceContext, true); this.referenceContext.initializerScope = new MethodScope(this, this.referenceContext, false); // build the binding or the local type - LocalTypeBinding localType = new LocalTypeBinding(this, enclosingType, innermostSwitchCase(), anonymousOriginalSuperType); + LocalTypeBinding localType = new LocalTypeBinding(this, enclosingType, innermostSwitchCase()); //{ObjectTeams: was assignment; use setter to allow additional setup /* @original this.referenceContext.binding = localType; @@ -382,7 +383,7 @@ public class ClassScope extends Scope { } } ClassScope memberScope = new ClassScope(this, this.referenceContext.memberTypes[i]); - LocalTypeBinding memberBinding = memberScope.buildLocalType(localType, null /* anonymous super type*/, packageBinding); + LocalTypeBinding memberBinding = memberScope.buildLocalType(localType, packageBinding); memberBinding.setAsMemberType(); memberTypeBindings[count++] = memberBinding; } @@ -395,7 +396,7 @@ public class ClassScope extends Scope { void buildLocalTypeBinding(SourceTypeBinding enclosingType) { - LocalTypeBinding localType = buildLocalType(enclosingType, null /* anonymous super type*/, enclosingType.fPackage); + LocalTypeBinding localType = buildLocalType(enclosingType, enclosingType.fPackage); connectTypeHierarchy(); if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { checkParameterizedTypeBounds(); @@ -779,9 +780,7 @@ public class ClassScope extends Scope { if ((memberTypeDeclaration.bits & ASTNode.IsLocalType) != 0) { // not added to member types - // FIXME(SH): as soon as LocalTypeBinding is complete re 210422 reconsider null: - // see also Bug 307523 - memberScope.buildLocalType(sourceType, null /* anonymous super type*/, getCurrentPackage()); + memberScope.buildLocalType(sourceType, getCurrentPackage()); // ensure the copy has the same relative constant pool name (e.g., "1" as in T$__OT__R$1) char[] computedConstantPoolName = CharOperation.concatWith( new char[][]{sourceType.constantPoolName(), memberTypeDeclaration.name}, '$'); @@ -2078,8 +2077,10 @@ public class ClassScope extends Scope { SourceTypeBinding sourceType = this.referenceContext.binding; if ((sourceType.tagBits & TagBits.BeginHierarchyCheck) == 0) { sourceType.tagBits |= TagBits.BeginHierarchyCheck; + environment().typesBeingConnected.add(sourceType); boolean noProblems = connectSuperclass(); noProblems &= connectSuperInterfaces(); + environment().typesBeingConnected.remove(sourceType); sourceType.tagBits |= TagBits.EndHierarchyCheck; noProblems &= connectTypeVariables(this.referenceContext.typeParameters, false); sourceType.tagBits |= TagBits.TypeVariablesAreConnected; @@ -2134,8 +2135,10 @@ public class ClassScope extends Scope { return; sourceType.tagBits |= TagBits.BeginHierarchyCheck; + environment().typesBeingConnected.add(sourceType); boolean noProblems = connectSuperclass(); noProblems &= connectSuperInterfaces(); + environment().typesBeingConnected.remove(sourceType); sourceType.tagBits |= TagBits.EndHierarchyCheck; noProblems &= connectTypeVariables(this.referenceContext.typeParameters, false); sourceType.tagBits |= TagBits.TypeVariablesAreConnected; @@ -2245,12 +2248,26 @@ public class ClassScope extends Scope { org.eclipse.jdt.internal.compiler.ast.TypeReference ref = ((SourceTypeBinding) superType).scope.superTypeReference; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=133071 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=121734 - if (ref != null && (ref.resolvedType == null || ((ReferenceBinding) ref.resolvedType).isHierarchyBeingActivelyConnected())) { + if (ref != null && ref.resolvedType != null && ((ReferenceBinding) ref.resolvedType).isHierarchyBeingActivelyConnected()) { problemReporter().hierarchyCircularity(sourceType, superType, reference); sourceType.tagBits |= TagBits.HierarchyHasProblems; superType.tagBits |= TagBits.HierarchyHasProblems; return true; } + if (ref != null && ref.resolvedType == null) { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 Don't cry foul prematurely. + // Check the edges traversed to see if there really is a cycle. + char [] referredName = ref.getLastToken(); + for (Iterator iter = environment().typesBeingConnected.iterator(); iter.hasNext();) { + SourceTypeBinding type = (SourceTypeBinding) iter.next(); + if (CharOperation.equals(referredName, type.sourceName())) { + problemReporter().hierarchyCircularity(sourceType, superType, reference); + sourceType.tagBits |= TagBits.HierarchyHasProblems; + superType.tagBits |= TagBits.HierarchyHasProblems; + return true; + } + } + } } if ((superType.tagBits & TagBits.BeginHierarchyCheck) == 0) // ensure if this is a source superclass that it has already been checked diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java index 59357edf3..f46003d82 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java @@ -436,8 +436,8 @@ void checkParameterizedTypes() { * be actually outputed if sitting inside unreachable code. */ public char[] computeConstantPoolName(LocalTypeBinding localType) { - if (localType.constantPoolName() != null) { - return localType.constantPoolName(); + if (localType.constantPoolName != null) { + return localType.constantPoolName; } // delegates to the outermost enclosing classfile, since it is the only one with a global vision of its innertypes. diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java index 7d3c76699..061da4349 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java @@ -24,4 +24,5 @@ public interface InvocationSite { void setFieldIndex(int depth); int sourceEnd(); int sourceStart(); + TypeBinding expectedType(); } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java index cc1cfe671..edc74434a 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -39,9 +39,7 @@ public final class LocalTypeBinding extends NestedTypeBinding { public int sourceStart; // used by computeUniqueKey to uniquely identify this binding public MethodBinding enclosingMethod; -// public ReferenceBinding anonymousOriginalSuperType; - -public LocalTypeBinding(ClassScope scope, SourceTypeBinding enclosingType, CaseStatement switchCase, ReferenceBinding anonymousOriginalSuperType) { +public LocalTypeBinding(ClassScope scope, SourceTypeBinding enclosingType, CaseStatement switchCase) { super( new char[][] {CharOperation.concat(LocalTypeBinding.LocalTypePrefix, scope.referenceContext.name)}, scope, @@ -139,7 +137,12 @@ public char[] computeUniqueKey(boolean isLeaf) { } public char[] constantPoolName() /* java/lang/Object */ { - return this.constantPoolName; + if (this.constantPoolName == null && this.scope != null) { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322154, we do have some + // cases where the left hand does not know what the right is doing. + this.constantPoolName = this.scope.compilationUnitScope().computeConstantPoolName(this); + } + return this.constantPoolName; } ArrayBinding createArrayType(int dimensionCount, LookupEnvironment lookupEnvironment) { @@ -164,7 +167,7 @@ ArrayBinding createArrayType(int dimensionCount, LookupEnvironment lookupEnviron * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=99686) */ public char[] genericTypeSignature() { - if (this.genericReferenceTypeSignature == null && constantPoolName() == null) { + if (this.genericReferenceTypeSignature == null && this.constantPoolName == null) { if (isAnonymousType()) setConstantPoolName(superclass().sourceName()); else @@ -248,7 +251,7 @@ public void computeConstantPoolName() { * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=102284) */ public char[] signature() { - if (this.signature == null && constantPoolName() == null) { + if (this.signature == null && this.constantPoolName == null) { if (isAnonymousType()) setConstantPoolName(superclass().sourceName()); else diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java index 81dfbd7f8..d19098376 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java @@ -14,7 +14,9 @@ package org.eclipse.jdt.internal.compiler.lookup; import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ClassFilePool; @@ -118,6 +120,7 @@ public class LookupEnvironment implements ProblemReasons, TypeConstants { public MethodBinding arrayClone; private ArrayList missingTypes; + Set typesBeingConnected; public boolean isProcessingAnnotations = false; final static int BUILD_FIELDS_AND_METHODS = 4; @@ -154,6 +157,7 @@ public LookupEnvironment(ITypeRequestor typeRequestor, CompilerOptions globalOpt this.missingTypes = null; this.accessRestrictions = new HashMap(3); this.classFilePool = ClassFilePool.newInstance(); + this.typesBeingConnected = new HashSet(); } /** @@ -1616,6 +1620,7 @@ public void reset() { this.uniqueParameterizedGenericMethodBindings = new SimpleLookupTable(3); this.uniqueGetClassMethodBinding = null; this.missingTypes = null; + this.typesBeingConnected = new HashSet(); for (int i = this.units.length; --i >= 0;) this.units[i] = null; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java index a88fbe7e4..8c1ef9ce4 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java @@ -651,9 +651,6 @@ public List collectMissingTypes(List missingTypes) { } } } - if (missingTypes == null) { - System.err.println("Could not find missing types in " + this); //$NON-NLS-1$ - } return missingTypes; } @@ -1480,7 +1477,7 @@ public final char[] signature(ClassFile classFile, TypeBinding constantPoolDecla return this.signature; } - StringBuffer buffer = new StringBuffer(this.parameters.length + 1 * 20); + StringBuffer buffer = new StringBuffer((this.parameters.length + 1) * 20); buffer.append('('); TypeBinding[] targetParameters = this.parameters; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java index bab9e8154..928b3a56f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -502,13 +502,9 @@ public boolean isInsideInitializerOrConstructor() { * to abort. */ public ProblemReporter problemReporter() { - MethodScope outerMethodScope; - if ((outerMethodScope = outerMostMethodScope()) == this) { - ProblemReporter problemReporter = referenceCompilationUnit().problemReporter; - problemReporter.referenceContext = this.referenceContext; - return problemReporter; - } - return outerMethodScope.problemReporter(); + ProblemReporter problemReporter = referenceCompilationUnit().problemReporter; + problemReporter.referenceContext = this.referenceContext; + return problemReporter; } public final int recordInitializationStates(FlowInfo flowInfo) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java index 0cf5fabea..4cfc8aece 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java @@ -468,10 +468,18 @@ void checkForRedundantSuperinterfaces(ReferenceBinding superclass, ReferenceBind if (superInterfaces == Binding.NO_SUPERINTERFACES) return; SimpleSet interfacesToCheck = new SimpleSet(superInterfaces.length); - next : for (int i = 0, l = superInterfaces.length; i < l; i++) { + SimpleSet redundantInterfaces = null; // bark but once. + for (int i = 0, l = superInterfaces.length; i < l; i++) { ReferenceBinding toCheck = superInterfaces[i]; for (int j = 0; j < l; j++) { - if (i != j && toCheck.implementsInterface(superInterfaces[j], true)) { + ReferenceBinding implementedInterface = superInterfaces[j]; + if (i != j && toCheck.implementsInterface(implementedInterface, true)) { + if (redundantInterfaces == null) { + redundantInterfaces = new SimpleSet(3); + } else if (redundantInterfaces.includes(implementedInterface)) { + continue; + } + redundantInterfaces.add(implementedInterface); TypeReference[] refs = this.type.scope.referenceContext.superInterfaces; //{ObjectTeams: implicit inheritance among role interfaces is not visible at AST level if (refs == null) @@ -479,64 +487,8 @@ void checkForRedundantSuperinterfaces(ReferenceBinding superclass, ReferenceBind // SH} for (int r = 0, rl = refs.length; r < rl; r++) { if (refs[r].resolvedType == toCheck) { - problemReporter().redundantSuperInterface(this.type, refs[j], superInterfaces[j], toCheck); - continue next; - } - } - } - } - interfacesToCheck.add(toCheck); - } - - ReferenceBinding[] itsInterfaces = null; - SimpleSet inheritedInterfaces = new SimpleSet(5); - ReferenceBinding superType = superclass; - while (superType != null && superType.isValidBinding()) { - if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) { - for (int i = 0, l = itsInterfaces.length; i < l; i++) { - ReferenceBinding inheritedInterface = itsInterfaces[i]; - if (!inheritedInterfaces.includes(inheritedInterface) && inheritedInterface.isValidBinding()) { - if (interfacesToCheck.includes(inheritedInterface)) { - TypeReference[] refs = this.type.scope.referenceContext.superInterfaces; - for (int r = 0, rl = refs.length; r < rl; r++) { - if (refs[r].resolvedType == inheritedInterface) { - problemReporter().redundantSuperInterface(this.type, refs[r], inheritedInterface, superType); - break; - } - } - } else { - inheritedInterfaces.add(inheritedInterface); - } - } - } - } - superType = superType.superclass(); - } - - int nextPosition = inheritedInterfaces.elementSize; - if (nextPosition == 0) return; - ReferenceBinding[] interfacesToVisit = new ReferenceBinding[nextPosition]; - inheritedInterfaces.asArray(interfacesToVisit); - for (int i = 0; i < nextPosition; i++) { - superType = interfacesToVisit[i]; - if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) { - int itsLength = itsInterfaces.length; - if (nextPosition + itsLength >= interfacesToVisit.length) - System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); - for (int a = 0; a < itsLength; a++) { - ReferenceBinding inheritedInterface = itsInterfaces[a]; - if (!inheritedInterfaces.includes(inheritedInterface) && inheritedInterface.isValidBinding()) { - if (interfacesToCheck.includes(inheritedInterface)) { - TypeReference[] refs = this.type.scope.referenceContext.superInterfaces; - for (int r = 0, rl = refs.length; r < rl; r++) { - if (refs[r].resolvedType == inheritedInterface) { - problemReporter().redundantSuperInterface(this.type, refs[r], inheritedInterface, superType); - break; - } - } - } else { - inheritedInterfaces.add(inheritedInterface); - interfacesToVisit[nextPosition++] = inheritedInterface; + problemReporter().redundantSuperInterface(this.type, refs[j], implementedInterface, toCheck); + break; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=320911 } } } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java index 643f5c3ee..536de96d4 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java @@ -655,6 +655,21 @@ void checkTypeVariableMethods(TypeParameter typeParameter) { int count = index + 1; while (--count > 0) { MethodBinding match = matchingInherited[count]; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=314556 + MethodBinding interfaceMethod = null, implementation = null; + if (first.declaringClass.isInterface()) { + interfaceMethod = first; + } else if (first.declaringClass.isClass()) { + implementation = first; + } + if (match.declaringClass.isInterface()) { + interfaceMethod = match; + } else if (match.declaringClass.isClass()) { + implementation = match; + } + if (interfaceMethod != null && implementation != null && !isAsVisible(implementation, interfaceMethod)) + problemReporter().inheritedMethodReducesVisibility(typeParameter, implementation, new MethodBinding [] {interfaceMethod}); + if (areReturnTypesCompatible(first, match)) continue; // unrelated interfaces - check to see if return types are compatible if (first.declaringClass.isInterface() && match.declaringClass.isInterface() && areReturnTypesCompatible(match, first)) @@ -736,6 +751,12 @@ MethodBinding computeSubstituteMethod(MethodBinding inheritedMethod, MethodBindi boolean detectInheritedNameClash(MethodBinding inherited, MethodBinding otherInherited) { if (!inherited.areParameterErasuresEqual(otherInherited)) return false; + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322001 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=323693 + // When reporting a name clash between two inherited methods, we should not look for a + // signature clash, but instead should be looking for method descriptor clash. + if (inherited.returnType.erasure() != otherInherited.returnType.erasure()) + return false; // skip it if otherInherited is defined by a subtype of inherited's declaringClass or vice versa. // avoid being order sensitive and check with the roles reversed also. if (inherited.declaringClass.erasure() != otherInherited.declaringClass.erasure()) { @@ -750,10 +771,17 @@ boolean detectInheritedNameClash(MethodBinding inherited, MethodBinding otherInh } boolean detectNameClash(MethodBinding current, MethodBinding inherited, boolean treatAsSynthetic) { MethodBinding methodToCheck = inherited; + MethodBinding original = methodToCheck.original(); // can be the same as inherited + if (!current.areParameterErasuresEqual(original)) + return false; if (!treatAsSynthetic) { // For a user method, see if current class overrides the inherited method. If it does, // then any grievance we may have ought to be against the current class's method and // NOT against any super implementations. https://bugs.eclipse.org/bugs/show_bug.cgi?id=293615 + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=315978 : we now defer this rather expensive + // check to just before reporting (the incorrect) name clash. In the event there is no name + // clash to report to begin with (the common case), no penalty needs to be paid. MethodBinding[] currentNamesakes = (MethodBinding[]) this.currentMethods.get(inherited.selector); if (currentNamesakes.length > 1) { // we know it ought to at least one and that current is NOT the override for (int i = 0, length = currentNamesakes.length; i < length; i++) { @@ -765,7 +793,7 @@ boolean detectNameClash(MethodBinding current, MethodBinding inherited, boolean } } } - MethodBinding original = methodToCheck.original(); // can be the same as inherited + original = methodToCheck.original(); // can be the same as inherited if (!current.areParameterErasuresEqual(original)) return false; original = inherited.original(); // For error reporting use, inherited.original() diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java index f6c71f5f7..23ba62b7f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java @@ -78,12 +78,7 @@ public class ParameterizedGenericMethodBinding extends ParameterizedMethodBindin System.arraycopy(inferenceContext.substitutes, 0, uncheckedArguments = new TypeBinding[length], 0, length); } if (methodSubstitute.returnType != TypeBinding.VOID) { - TypeBinding expectedType = null; - // if message invocation has expected type - if (invocationSite instanceof MessageSend) { - MessageSend message = (MessageSend) invocationSite; - expectedType = message.expectedType; - } + TypeBinding expectedType = invocationSite.expectedType(); if (expectedType != null) { // record it was explicit from context, as opposed to assumed by default (see below) inferenceContext.hasExplicitExpectedType = true; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java index 350f97bef..6c86ca400 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java @@ -31,12 +31,15 @@ public class ParameterizedMethodBinding extends MethodBinding { super( originalMethod.modifiers, originalMethod.selector, - originalMethod.returnType, + originalMethod.returnType, originalMethod.parameters, originalMethod.thrownExceptions, parameterizedDeclaringClass); this.originalMethod = originalMethod; - this.tagBits = originalMethod.tagBits; + /* missing type bit cannot be copied as is it might come from the return type or a parameter type that + * is substituted by a raw type. + */ + this.tagBits = originalMethod.tagBits & ~TagBits.HasMissingType; final TypeVariableBinding[] originalVariables = originalMethod.typeVariables; Substitution substitution = null; @@ -63,13 +66,13 @@ public class ParameterizedMethodBinding extends MethodBinding { return !isStatic && parameterizedDeclaringClass.isRawSubstitution(); } public TypeBinding substitute(TypeVariableBinding typeVariable) { - // check this variable can be substituted given copied variables - if (typeVariable.rank < length && originalVariables[typeVariable.rank] == typeVariable) { + // check this variable can be substituted given copied variables + if (typeVariable.rank < length && originalVariables[typeVariable.rank] == typeVariable) { return substitutedVariables[typeVariable.rank]; - } - if (!isStatic) + } + if (!isStatic) return parameterizedDeclaringClass.substitute(typeVariable); - return typeVariable; + return typeVariable; } //{ObjectTeams: implement new method from Substitution public ITeamAnchor substituteAnchor(ITeamAnchor anchor, int rank) { @@ -112,8 +115,8 @@ public class ParameterizedMethodBinding extends MethodBinding { this.returnType = Scope.substitute(substitution, this.returnType); this.parameters = Scope.substitute(substitution, this.parameters); this.thrownExceptions = Scope.substitute(substitution, this.thrownExceptions); - // error case where exception type variable would have been substituted by a non-reference type (207573) - if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; + // error case where exception type variable would have been substituted by a non-reference type (207573) + if (this.thrownExceptions == null) this.thrownExceptions = Binding.NO_EXCEPTIONS; } checkMissingType: { if ((this.tagBits & TagBits.HasMissingType) != 0) @@ -150,7 +153,10 @@ public class ParameterizedMethodBinding extends MethodBinding { originalMethod.thrownExceptions, declaringClass); this.originalMethod = originalMethod; - this.tagBits = originalMethod.tagBits; + /* missing type bit cannot be copied as is it might come from the return type or a parameter type that + * is substituted by a raw type. + */ + this.tagBits = originalMethod.tagBits & ~TagBits.HasMissingType; final TypeVariableBinding[] originalVariables = originalMethod.typeVariables; Substitution substitution = null; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java index 33183d4ee..ec7c1dc32 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -26,8 +26,30 @@ public class RawTypeBinding extends ParameterizedTypeBinding { */ public RawTypeBinding(ReferenceBinding type, ReferenceBinding enclosingType, LookupEnvironment environment){ super(type, null, enclosingType, environment); - if (enclosingType == null || (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) + this.tagBits &= ~TagBits.HasMissingType; + if ((type.tagBits & TagBits.HasMissingType) != 0) { + if (type instanceof MissingTypeBinding) { + this.tagBits |= TagBits.HasMissingType; + } else if (type instanceof ParameterizedTypeBinding) { + ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) type; + if (parameterizedTypeBinding.genericType() instanceof MissingTypeBinding) { + this.tagBits |= TagBits.HasMissingType; + } + } + } + if (enclosingType != null && (enclosingType.tagBits & TagBits.HasMissingType) != 0) { + if (enclosingType instanceof MissingTypeBinding) { + this.tagBits |= TagBits.HasMissingType; + } else if (enclosingType instanceof ParameterizedTypeBinding) { + ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) enclosingType; + if (parameterizedTypeBinding.genericType() instanceof MissingTypeBinding) { + this.tagBits |= TagBits.HasMissingType; + } + } + } + if (enclosingType == null || (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) { this.modifiers &= ~ExtraCompilerModifiers.AccGenericSignature; // only need signature if enclosing needs one + } } public char[] computeUniqueKey(boolean isLeaf) { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java index 49803cfc9..c9dc01de9 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java @@ -637,7 +637,13 @@ public abstract class Scope { * @param checkForErasedCandidateCollisions */ protected boolean connectTypeVariables(TypeParameter[] typeParameters, boolean checkForErasedCandidateCollisions) { - if (typeParameters == null || compilerOptions().sourceLevel < ClassFileConstants.JDK1_5) return true; + /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 - We used to not bother with connecting + type variables if source level is < 1.5. This creates problems in the reconciler if a 1.4 + project references the generified API of a 1.5 project. The "current" project's source + level cannot decide this question for some other project. Now, if we see type parameters + at all, we assume that the concerned java element has some legitimate business with them. + */ + if (typeParameters == null || typeParameters.length == 0) return true; Map invocations = new HashMap(2); boolean noProblems = true; // preinitializing each type variable @@ -1052,7 +1058,6 @@ public abstract class Scope { } return null; } - // Internal use only /* Answer the field binding that corresponds to fieldName. Start the lookup at the receiverType. @@ -1060,10 +1065,23 @@ public abstract class Scope { isSuperAccess(); this is used to determine if the discovered field is visible. Only fields defined by the receiverType or its supertypes are answered; a field of an enclosing type will not be found using this API. - + If no visible field is discovered, null is answered. + */ + public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) { + return findField(receiverType, fieldName, invocationSite, needResolve, false); + } + // Internal use only + /* Answer the field binding that corresponds to fieldName. + Start the lookup at the receiverType. + InvocationSite implements + isSuperAccess(); this is used to determine if the discovered field is visible. + Only fields defined by the receiverType or its supertypes are answered; + a field of an enclosing type will not be found using this API. + If the parameter invisibleFieldsOk is true, visibility checks have not been run on + any returned fields. The caller needs to apply these checks as needed. Otherwise, If no visible field is discovered, null is answered. */ - public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve) { + public FieldBinding findField(TypeBinding receiverType, char[] fieldName, InvocationSite invocationSite, boolean needResolve, boolean invisibleFieldsOk) { CompilationUnitScope unitScope = compilationUnitScope(); unitScope.recordTypeReference(receiverType); @@ -1111,8 +1129,13 @@ public abstract class Scope { currentType.initializeForStaticImports(); FieldBinding field = currentType.getField(fieldName, needResolve); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316456 + boolean insideTypeAnnotations = this instanceof MethodScope && ((MethodScope) this).insideTypeAnnotation; if (field != null) { - if (invocationSite == null + if (invisibleFieldsOk) { + return field; + } + if (invocationSite == null || insideTypeAnnotations ? field.canBeSeenBy(getCurrentPackage()) : field.canBeSeenBy(currentType, invocationSite, this)) return field; @@ -1150,6 +1173,9 @@ public abstract class Scope { currentType.initializeForStaticImports(); currentType = (ReferenceBinding) currentType.capture(this, invocationSite == null ? 0 : invocationSite.sourceEnd()); if ((field = currentType.getField(fieldName, needResolve)) != null) { + if (invisibleFieldsOk) { + return field; + } keepLooking = false; if (field.canBeSeenBy(receiverType, invocationSite, this)) { if (visibleField == null) @@ -1171,6 +1197,9 @@ public abstract class Scope { unitScope.recordTypeReference(anInterface); // no need to capture rcv interface, since member field is going to be static anyway if ((field = anInterface.getField(fieldName, true /*resolve*/)) != null) { + if (invisibleFieldsOk) { + return field; + } if (visibleField == null) { visibleField = field; } else { @@ -1854,7 +1883,9 @@ public abstract class Scope { } if (foundField.isValidBinding()) // if a valid field was found, complain when another is found in an 'immediate' enclosing type (that is, not inherited) - if (foundField.declaringClass != fieldBinding.declaringClass) + // but only if "valid field" was inherited in the first place. + if (foundField.declaringClass != fieldBinding.declaringClass && + foundField.declaringClass != foundActualReceiverType) // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316956 // i.e. have we found the same field - do not trust field identity yet return new ProblemFieldBinding( foundField, // closest match @@ -4025,6 +4056,7 @@ public abstract class Scope { public void setFieldIndex(int depth) { /* ignore */} public int sourceStart() { return invocationSite.sourceStart(); } public int sourceEnd() { return invocationSite.sourceStart(); } + public TypeBinding expectedType() { return invocationSite.expectedType(); } }; MethodBinding[] moreSpecific = new MethodBinding[visibleSize]; int count = 0; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java index 687f0df94..4b8c8cffc 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java @@ -724,6 +724,15 @@ public SyntheticMethodBinding addSyntheticMethod(MethodBinding targetMethod, boo accessors[isSuperAccess ? 0 : 1] = accessMethod; } } + if (targetMethod.declaringClass.isStatic()) { + if ((targetMethod.isConstructor() && targetMethod.parameters.length >= 0xFE) + || targetMethod.parameters.length >= 0xFF) { + this.scope.problemReporter().tooManyParametersForSyntheticMethod(targetMethod.sourceMethod()); + } + } else if ((targetMethod.isConstructor() && targetMethod.parameters.length >= 0xFD) + || targetMethod.parameters.length >= 0xFE) { + this.scope.problemReporter().tooManyParametersForSyntheticMethod(targetMethod.sourceMethod()); + } return accessMethod; } //{ObjectTeams: add OT-specific synthetic bridges: @@ -1809,75 +1818,75 @@ public FieldBinding resolveTypeFor(FieldBinding field) { if (fieldDecls[f].binding != field) continue; - MethodScope initializationScope = field.isStatic() - ? this.scope.referenceContext.staticInitializerScope - : this.scope.referenceContext.initializerScope; - FieldBinding previousField = initializationScope.initializedField; - try { - initializationScope.initializedField = field; - FieldDeclaration fieldDecl = fieldDecls[f]; - TypeBinding fieldType = - fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT - ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type - : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/); - field.type = fieldType; - field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved; - if (fieldType == null) { - fieldDecl.binding = null; - return null; - } - if (fieldType == TypeBinding.VOID) { - this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl); - fieldDecl.binding = null; - return null; - } - if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == TypeBinding.VOID) { - this.scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecl); - fieldDecl.binding = null; - return null; - } - if ((fieldType.tagBits & TagBits.HasMissingType) != 0) { - field.tagBits |= TagBits.HasMissingType; - } - TypeBinding leafType = fieldType.leafComponentType(); - if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) { - field.modifiers |= ExtraCompilerModifiers.AccGenericSignature; + MethodScope initializationScope = field.isStatic() + ? this.scope.referenceContext.staticInitializerScope + : this.scope.referenceContext.initializerScope; + FieldBinding previousField = initializationScope.initializedField; + try { + initializationScope.initializedField = field; + FieldDeclaration fieldDecl = fieldDecls[f]; + TypeBinding fieldType = + fieldDecl.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT + ? initializationScope.environment().convertToRawType(this, false /*do not force conversion of enclosing types*/) // enum constant is implicitly of declaring enum type + : fieldDecl.type.resolveType(initializationScope, true /* check bounds*/); + field.type = fieldType; + field.modifiers &= ~ExtraCompilerModifiers.AccUnresolved; + if (fieldType == null) { + fieldDecl.binding = null; + return null; + } + if (fieldType == TypeBinding.VOID) { + this.scope.problemReporter().variableTypeCannotBeVoid(fieldDecl); + fieldDecl.binding = null; + return null; + } + if (fieldType.isArrayType() && ((ArrayBinding) fieldType).leafComponentType == TypeBinding.VOID) { + this.scope.problemReporter().variableTypeCannotBeVoidArray(fieldDecl); + fieldDecl.binding = null; + return null; + } + if ((fieldType.tagBits & TagBits.HasMissingType) != 0) { + field.tagBits |= TagBits.HasMissingType; + } + TypeBinding leafType = fieldType.leafComponentType(); + if (leafType instanceof ReferenceBinding && (((ReferenceBinding)leafType).modifiers & ExtraCompilerModifiers.AccGenericSignature) != 0) { + field.modifiers |= ExtraCompilerModifiers.AccGenericSignature; + } + } finally { + initializationScope.initializedField = previousField; } - } finally { - initializationScope.initializedField = previousField; - } //{ObjectTeams: copy-inherited fields and anchored types: - if (fieldDecls[f].getKind() != AbstractVariableDeclaration.ENUM_CONSTANT) { - if (fieldDecls[f].type == null) // should not happen for non-enum types - throw new InternalCompilerError("Field "+fieldDecls[f]+" has no type in "+this); - - field.copyInheritanceSrc = fieldDecls[f].copyInheritanceSrc; - field.maybeSetFieldTypeAnchorAttribute(); - // anchored to tthis? - field.type = RoleTypeCreator.maybeWrapUnqualifiedRoleType(this.scope, field.type, fieldDecls[f].type); - if (field.couldBeTeamAnchor()) { - // link decl and binding via model - // for early resolving from TeamAnchor.hasSameBestNameAs() - FieldModel.getModel(fieldDecls[f]).setBinding(field); + if (fieldDecls[f].getKind() != AbstractVariableDeclaration.ENUM_CONSTANT) { + if (fieldDecls[f].type == null) // should not happen for non-enum types + throw new InternalCompilerError("Field "+fieldDecls[f]+" has no type in "+this); + + field.copyInheritanceSrc = fieldDecls[f].copyInheritanceSrc; + field.maybeSetFieldTypeAnchorAttribute(); + // anchored to tthis? + field.type = RoleTypeCreator.maybeWrapUnqualifiedRoleType(this.scope, field.type, fieldDecls[f].type); + if (field.couldBeTeamAnchor()) { + // link decl and binding via model + // for early resolving from TeamAnchor.hasSameBestNameAs() + FieldModel.getModel(fieldDecls[f]).setBinding(field); + } } - } - // need role field bridges? - if ( isRole() - && ((field.modifiers & ClassFileConstants.AccPrivate) != 0) - && !CharOperation.prefixEquals(IOTConstants.OT_DOLLAR_NAME, field.name)) - { - MethodBinding inner; - ReferenceBinding originalRole = field.declaringClass; - if (field.copyInheritanceSrc != null) - originalRole = field.copyInheritanceSrc.declaringClass; - inner = FieldModel.getDecapsulatingFieldAccessor(this, field, true/*isGetter*/); - ((SourceTypeBinding) enclosingType()).addSyntheticRoleMethodBridge(this, originalRole, inner, SyntheticMethodBinding.RoleMethodBridgeOuter); - if (!field.isFinal()) { // no setter for final (includes all static role fields) - // otherwise we would have to handle different signatures (w/ w/o role arg), which we currently don't - inner = FieldModel.getDecapsulatingFieldAccessor(this, field, false/*isGetter*/); + // need role field bridges? + if ( isRole() + && ((field.modifiers & ClassFileConstants.AccPrivate) != 0) + && !CharOperation.prefixEquals(IOTConstants.OT_DOLLAR_NAME, field.name)) + { + MethodBinding inner; + ReferenceBinding originalRole = field.declaringClass; + if (field.copyInheritanceSrc != null) + originalRole = field.copyInheritanceSrc.declaringClass; + inner = FieldModel.getDecapsulatingFieldAccessor(this, field, true/*isGetter*/); ((SourceTypeBinding) enclosingType()).addSyntheticRoleMethodBridge(this, originalRole, inner, SyntheticMethodBinding.RoleMethodBridgeOuter); + if (!field.isFinal()) { // no setter for final (includes all static role fields) + // otherwise we would have to handle different signatures (w/ w/o role arg), which we currently don't + inner = FieldModel.getDecapsulatingFieldAccessor(this, field, false/*isGetter*/); + ((SourceTypeBinding) enclosingType()).addSyntheticRoleMethodBridge(this, originalRole, inner, SyntheticMethodBinding.RoleMethodBridgeOuter); + } } - } // SH} return field; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java index 52e1ecfb3..c3e682ebf 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java @@ -386,14 +386,15 @@ public class SyntheticMethodBinding extends MethodBinding { this.selector = accessedConstructor.selector; this.returnType = accessedConstructor.returnType; this.purpose = SyntheticMethodBinding.ConstructorAccess; - this.parameters = new TypeBinding[accessedConstructor.parameters.length + 1]; + final int parametersLength = accessedConstructor.parameters.length; + this.parameters = new TypeBinding[parametersLength + 1]; System.arraycopy( accessedConstructor.parameters, 0, this.parameters, 0, - accessedConstructor.parameters.length); - this.parameters[accessedConstructor.parameters.length] = + parametersLength); + this.parameters[parametersLength] = accessedConstructor.declaringClass; this.thrownExceptions = accessedConstructor.thrownExceptions; this.declaringClass = sourceType; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java index 776afcc79..4aedb82c1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java @@ -39,6 +39,9 @@ public interface TagBits { // for method long HasUncheckedTypeArgumentForBoundCheck = ASTNode.Bit9; + // local variable + long NotInitialized = ASTNode.Bit9; + // set when method has argument(s) that couldn't be resolved long HasUnresolvedArguments = ASTNode.Bit10; diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java index df45e0e62..4803939d7 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephen Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 317046 * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -307,7 +308,7 @@ public TypeBinding findSuperTypeOriginatingFrom(TypeBinding otherType) { int nextPosition = 0; do { ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); - if (itsInterfaces != Binding.NO_SUPERINTERFACES) { + if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { if (interfacesToVisit == null) { interfacesToVisit = itsInterfaces; nextPosition = interfacesToVisit.length; @@ -332,7 +333,7 @@ public TypeBinding findSuperTypeOriginatingFrom(TypeBinding otherType) { if (currentType.original() == otherType) return currentType; ReferenceBinding[] itsInterfaces = currentType.superInterfaces(); - if (itsInterfaces != Binding.NO_SUPERINTERFACES) { + if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) { int itsLength = itsInterfaces.length; if (nextPosition + itsLength >= interfacesToVisit.length) System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); @@ -597,11 +598,12 @@ public boolean isParameterizedWithOwnVariables() { return true; } -private boolean isProvableDistinctSubType(TypeBinding otherType) { +private boolean isProvableDistinctSubType(TypeBinding otherType, boolean isClassLiteral) { if (otherType.isInterface()) { if (isInterface()) return false; if (isArrayType() + || isClassLiteral // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322531 || ((this instanceof ReferenceBinding) && ((ReferenceBinding) this).isFinal()) || (isTypeVariable() && ((TypeVariableBinding)this).superclass().isFinal())) { return !isCompatibleWith(otherType); @@ -610,6 +612,7 @@ private boolean isProvableDistinctSubType(TypeBinding otherType) { } else { if (isInterface()) { if (otherType.isArrayType() + || isClassLiteral // https://bugs.eclipse.org/bugs/show_bug.cgi?id=322531 || ((otherType instanceof ReferenceBinding) && ((ReferenceBinding) otherType).isFinal()) || (otherType.isTypeVariable() && ((TypeVariableBinding)otherType).superclass().isFinal())) { return !isCompatibleWith(otherType); @@ -665,23 +668,22 @@ public boolean isProvablyDistinct(TypeBinding otherType) { return false; case Binding.GENERIC_TYPE : - SourceTypeBinding otherGenericType = (SourceTypeBinding) otherType; - if (paramType.genericType() != otherGenericType) + if (paramType.genericType() != otherType) return true; if (!paramType.isStatic()) { // static member types do not compare their enclosing ReferenceBinding enclosing = enclosingType(); if (enclosing != null) { - ReferenceBinding otherEnclosing = otherGenericType.enclosingType(); + ReferenceBinding otherEnclosing = otherType.enclosingType(); if (otherEnclosing == null) return true; if ((otherEnclosing.tagBits & TagBits.HasDirectWildcard) == 0) { if (enclosing != otherEnclosing) return true; } else { - if (!enclosing.isEquivalentTo(otherGenericType.enclosingType())) return true; + if (!enclosing.isEquivalentTo(otherType.enclosingType())) return true; } } } length = paramType.arguments == null ? 0 : paramType.arguments.length; - otherArguments = otherGenericType.typeVariables(); + otherArguments = otherType.typeVariables(); otherLength = otherArguments == null ? 0 : otherArguments.length; if (otherLength != length) return true; @@ -743,6 +745,7 @@ private boolean isProvablyDistinctTypeArgument(TypeBinding otherArgument, final TypeBinding upperBound1 = null; TypeBinding lowerBound1 = null; + ReferenceBinding genericType = paramType.genericType(); switch (kind()) { case Binding.WILDCARD_TYPE : WildcardBinding wildcard = (WildcardBinding) this; @@ -777,7 +780,7 @@ private boolean isProvablyDistinctTypeArgument(TypeBinding otherArgument, final } if (variable.firstBound == null) // unbound variable return false; - TypeBinding eliminatedType = Scope.convertEliminatingTypeVariables(variable, paramType.genericType(), rank, null); + TypeBinding eliminatedType = Scope.convertEliminatingTypeVariables(variable, genericType, rank, null); switch (eliminatedType.kind()) { case Binding.WILDCARD_TYPE : case Binding.INTERSECTION_TYPE : @@ -832,7 +835,7 @@ private boolean isProvablyDistinctTypeArgument(TypeBinding otherArgument, final } if (otherVariable.firstBound == null) // unbound variable return false; - TypeBinding otherEliminatedType = Scope.convertEliminatingTypeVariables(otherVariable, paramType.genericType(), rank, null); + TypeBinding otherEliminatedType = Scope.convertEliminatingTypeVariables(otherVariable, genericType, rank, null); switch (otherEliminatedType.kind()) { case Binding.WILDCARD_TYPE : case Binding.INTERSECTION_TYPE : @@ -869,10 +872,10 @@ private boolean isProvablyDistinctTypeArgument(TypeBinding otherArgument, final if (lowerBound2 != null) { return !lowerBound2.isCompatibleWith(upperBound1); } else if (upperBound2 != null) { - return upperBound1.isProvableDistinctSubType(upperBound2) - && upperBound2.isProvableDistinctSubType(upperBound1); + return upperBound1.isProvableDistinctSubType(upperBound2, false) + && upperBound2.isProvableDistinctSubType(upperBound1, false); } else { - return otherArgument.isProvableDistinctSubType(upperBound1); + return otherArgument.isProvableDistinctSubType(upperBound1, genericType.id == TypeIds.T_JavaLangClass); } } else { if (lowerBound2 != null) { @@ -881,7 +884,7 @@ private boolean isProvablyDistinctTypeArgument(TypeBinding otherArgument, final } return !lowerBound2.isCompatibleWith(this); } else if (upperBound2 != null) { - return isProvableDistinctSubType(upperBound2); + return isProvableDistinctSubType(upperBound2, genericType.id == TypeIds.T_JavaLangClass); } else { return true; // ground types should have been the same } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java index 9873f4fbc..8081de3ef 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java @@ -1419,6 +1419,17 @@ protected void consumeAnnotationTypeDeclaration() { //convert constructor that do not have the type's name into methods typeDecl.checkConstructors(this); + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=212713, + // reject initializers that have been tolerated by the grammar. + FieldDeclaration [] fields = typeDecl.fields; + int fieldCount = fields == null ? 0 : fields.length; + for (int i = 0; i < fieldCount; i++) { + FieldDeclaration field = fields[i]; + if (field instanceof Initializer) { + problemReporter().interfaceCannotHaveInitializers(typeDecl.name, field); + } + } //always add <clinit> (will be remove at code gen time if empty) if (this.scanner.containsAssertKeyword) { @@ -1930,7 +1941,8 @@ protected void consumeBinaryExpression(int op) { } break; case LESS : - this.intPtr--; + case MULTIPLY : + this.intPtr--; // star end position or starting position of angle bracket this.expressionStack[this.expressionPtr] = new BinaryExpression( expr1, @@ -2053,7 +2065,8 @@ protected void consumeBinaryExpressionWithName(int op) { } break; case LESS : - this.intPtr--; + case MULTIPLY : + this.intPtr--; // star end position or starting position of angle bracket this.expressionStack[this.expressionPtr] = new BinaryExpression( expr1, @@ -6170,7 +6183,7 @@ protected void consumePackageDeclarationName() { 0, length); - impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccDefault); + impt = new ImportReference(tokens, positions, false, ClassFileConstants.AccDefault); this.compilationUnit.currentPackage = impt; if (this.currentToken == TokenNameSEMICOLON){ @@ -6220,7 +6233,7 @@ protected void consumePackageDeclarationNameWithModifiers() { this.currentIsRole = true; // the type declaration to follow a team package must be a role. } // SH} - impt = new ImportReference(tokens, positions, true, packageModifiers); + impt = new ImportReference(tokens, positions, false, packageModifiers); this.compilationUnit.currentPackage = impt; // consume annotations if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { @@ -7485,1403 +7498,1403 @@ protected void consumeRule(int act) { consumeInvalidConstructorDeclaration(false); break; - case 338 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ + case 341 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$ consumePushLeftBrace(); break; - case 339 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ + case 342 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$ consumeEmptyArrayInitializer(); break; - case 340 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ + case 343 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ consumeArrayInitializer(); break; - case 341 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ + case 344 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$ consumeArrayInitializer(); break; - case 343 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ + case 346 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$ consumeVariableInitializers(); break; - case 344 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ + case 347 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$ consumeBlock(); break; - case 345 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ + case 348 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$ consumeOpenBlock() ; break; - case 347 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ + case 350 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$ consumeBlockStatements() ; break; - case 351 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ + case 354 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$ consumeInvalidInterfaceDeclaration(); break; - case 352 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ + case 355 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$ consumeInvalidAnnotationTypeDeclaration(); break; - case 353 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ + case 356 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$ consumeInvalidEnumDeclaration(); break; - case 354 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ + case 357 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$ consumeLocalVariableDeclarationStatement(); break; - case 355 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$ + case 358 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$ consumeLocalVariableDeclaration(); break; - case 356 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$ + case 359 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$ consumeLocalVariableDeclaration(); break; - case 357 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ + case 360 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$ consumePushModifiers(); break; - case 358 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ + case 361 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$ consumePushModifiersForHeader(); break; - case 359 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ + case 362 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$ consumePushRealModifiers(); break; - case 386 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ + case 389 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$ consumeEmptyStatement(); break; - case 387 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ + case 390 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$ consumeStatementLabel() ; break; - case 388 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ + case 391 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$ consumeStatementLabel() ; break; - case 389 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ + case 392 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$ consumeLabel() ; break; - case 390 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ + case 393 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$ consumeExpressionStatement(); break; - case 400 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 403 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementIfNoElse(); break; - case 401 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 404 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementIfWithElse(); break; - case 402 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ + case 405 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$ consumeStatementIfWithElse(); break; - case 403 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 406 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementSwitch() ; break; - case 404 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ + case 407 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$ consumeEmptySwitchBlock() ; break; - case 407 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ + case 410 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$ consumeSwitchBlock() ; break; - case 409 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ + case 412 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$ consumeSwitchBlockStatements() ; break; - case 410 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ + case 413 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$ consumeSwitchBlockStatement() ; break; - case 412 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ + case 415 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$ consumeSwitchLabels() ; break; - case 413 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ + case 416 : if (DEBUG) { System.out.println("SwitchLabel ::= case ConstantExpression COLON"); } //$NON-NLS-1$ consumeCaseLabel(); break; - case 414 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ + case 417 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$ consumeDefaultLabel(); break; - case 415 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 418 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeStatementWhile() ; break; - case 416 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ + case 419 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$ consumeStatementWhile() ; break; - case 417 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ + case 420 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$ consumeStatementDo() ; break; - case 418 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ + case 421 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$ consumeStatementFor() ; break; - case 419 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ + case 422 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$ consumeStatementFor() ; break; - case 420 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ + case 423 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$ consumeForInit() ; break; - case 424 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ + case 427 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$ consumeStatementExpressionList() ; break; - case 425 : if (DEBUG) { System.out.println("WithinStatement ::= within LPAREN Expression RPAREN..."); } //$NON-NLS-1$ + case 428 : if (DEBUG) { System.out.println("WithinStatement ::= within LPAREN Expression RPAREN..."); } //$NON-NLS-1$ consumeWithinStatement(); break; - case 426 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ + case 429 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$ consumeSimpleAssertStatement() ; break; - case 427 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ + case 430 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$ consumeAssertStatement() ; break; - case 428 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ + case 431 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$ consumeStatementBreak() ; break; - case 429 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ + case 432 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$ consumeStatementBreakWithLabel() ; break; - case 430 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ + case 433 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$ consumeStatementContinue() ; break; - case 431 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ + case 434 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$ consumeStatementContinueWithLabel() ; break; - case 432 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ + case 435 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$ consumeStatementReturn() ; break; - case 433 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ + case 436 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$ consumeStatementThrow(); break; - case 434 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ + case 437 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$ consumeStatementSynchronized(); break; - case 435 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ + case 438 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$ consumeOnlySynchronized(); break; - case 436 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ + case 439 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$ consumeStatementTry(false); break; - case 437 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ + case 440 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$ consumeStatementTry(true); break; - case 439 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ + case 442 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$ consumeExitTryBlock(); break; - case 441 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ + case 444 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$ consumeCatches(); break; - case 442 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$ + case 445 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN FormalParameter RPAREN..."); } //$NON-NLS-1$ consumeStatementCatch() ; break; - case 444 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ + case 447 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$ consumeLeftParen(); break; - case 445 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ + case 448 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$ consumeRightParen(); break; - case 450 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ + case 453 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$ consumePrimaryNoNewArrayThis(); break; - case 451 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ + case 454 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$ consumePrimaryNoNewArray(); break; - case 452 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ + case 455 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$ consumePrimaryNoNewArrayWithName(); break; - case 456 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ + case 459 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$ consumePrimaryNoNewArrayNameThis(); break; - case 457 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ + case 460 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT super"); } //$NON-NLS-1$ consumePrimaryNoNewArrayNameSuper(); break; - case 458 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ + case 461 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayName(); break; - case 459 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ + case 462 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayArrayType(); break; - case 460 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ + case 463 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayPrimitiveArrayType(); break; - case 461 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ + case 464 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$ consumePrimaryNoNewArrayPrimitiveType(); break; - case 462 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ + case 465 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ consumeRoleClassLiteral(); break; - case 465 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ + case 468 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$ consumeAllocationHeader(); break; - case 466 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ + case 469 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionWithTypeArguments(); break; - case 467 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN"); } //$NON-NLS-1$ + case 470 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType LPAREN"); } //$NON-NLS-1$ consumeClassInstanceCreationExpression(); break; - case 468 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ + case 471 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; break; - case 469 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ + case 472 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualified() ; break; - case 470 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ + case 473 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualified() ; break; - case 471 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ + case 474 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ; break; - case 472 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ + case 475 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT"); } //$NON-NLS-1$ consumeClassInstanceCreationExpressionName() ; break; - case 473 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ + case 476 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$ consumeClassBodyopt(); break; - case 475 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ + case 478 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ consumeEnterAnonymousClassBody(false); break; - case 476 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ + case 479 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$ consumeClassBodyopt(); break; - case 478 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ + case 481 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$ consumeEnterAnonymousClassBody(true); break; - case 480 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ + case 483 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$ consumeArgumentList(); break; - case 481 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$ + case 484 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$ consumeArrayCreationHeader(); break; - case 482 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ + case 485 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$ consumeArrayCreationHeader(); break; - case 483 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ + case 486 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ consumeArrayCreationExpressionWithoutInitializer(); break; - case 484 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$ + case 487 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$ consumeArrayCreationExpressionWithInitializer(); break; - case 485 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ + case 488 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$ consumeArrayCreationExpressionWithoutInitializer(); break; - case 486 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ + case 489 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$ consumeArrayCreationExpressionWithInitializer(); break; - case 488 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ + case 491 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$ consumeDimWithOrWithOutExprs(); break; - case 490 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ + case 493 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ consumeDimWithOrWithOutExpr(); break; - case 491 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ + case 494 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$ consumeDims(); break; - case 494 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ + case 497 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$ consumeOneDimLoop(); break; - case 495 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ + case 498 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$ consumeFieldAccess(false); break; - case 496 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ + case 499 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$ consumeFieldAccess(true); break; - case 497 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ + case 500 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ consumeMethodInvocationName(); break; - case 498 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 501 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationNameWithTypeArguments(); break; - case 499 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 502 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationPrimaryWithTypeArguments(); break; - case 500 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ + case 503 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$ consumeMethodInvocationPrimary(); break; - case 501 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 504 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationSuperWithTypeArguments(); break; - case 502 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ + case 505 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$ consumeMethodInvocationSuper(); break; - case 503 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT Identifier LPAREN..."); } //$NON-NLS-1$ + case 506 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT Identifier LPAREN..."); } //$NON-NLS-1$ consumeMethodInvocationTSuper(UNQUALIFIED); break; - case 504 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 507 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationTSuperWithTypeArguments(0); break; - case 505 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT Identifier..."); } //$NON-NLS-1$ + case 508 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT Identifier..."); } //$NON-NLS-1$ consumeMethodInvocationTSuper(QUALIFIED); break; - case 506 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT..."); } //$NON-NLS-1$ + case 509 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT..."); } //$NON-NLS-1$ consumeMethodInvocationTSuperWithTypeArguments(2); break; - case 507 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT Identifier LPAREN..."); } //$NON-NLS-1$ + case 510 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT Identifier LPAREN..."); } //$NON-NLS-1$ consumeMethodInvocationBase(false); break; - case 508 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT OnlyTypeArguments..."); } //$NON-NLS-1$ + case 511 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT OnlyTypeArguments..."); } //$NON-NLS-1$ consumeMethodInvocationBaseWithTypeArguments(false); break; - case 509 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT Identifier..."); } //$NON-NLS-1$ + case 512 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT Identifier..."); } //$NON-NLS-1$ consumeMethodInvocationBase(true); break; - case 510 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT..."); } //$NON-NLS-1$ + case 513 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT..."); } //$NON-NLS-1$ consumeMethodInvocationBaseWithTypeArguments(true); break; - case 511 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ + case 514 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$ consumeArrayAccess(true); break; - case 512 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ + case 515 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$ consumeArrayAccess(false); break; - case 513 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ + case 516 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$ consumeArrayAccess(false); break; - case 515 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ + case 518 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$ consumePostfixExpression(); break; - case 518 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ + case 521 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS,true); break; - case 519 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ + case 522 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS,true); break; - case 520 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ + case 523 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$ consumePushPosition(); break; - case 523 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ + case 526 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS); break; - case 524 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ + case 527 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS); break; - case 526 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ + case 529 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS,false); break; - case 527 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ + case 530 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS,false); break; - case 529 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ + case 532 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.TWIDDLE); break; - case 530 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ + case 533 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.NOT); break; - case 532 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ + case 535 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$ consumeCastExpressionWithPrimitiveType(); break; - case 533 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ + case 536 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ consumeCastExpressionWithGenericsArray(); break; - case 534 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ + case 537 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$ consumeCastExpressionWithQualifiedGenericsArray(); break; - case 535 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$ + case 538 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$ consumeCastExpressionLL1(); break; - case 536 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); } //$NON-NLS-1$ + case 539 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims PushRPAREN..."); } //$NON-NLS-1$ consumeCastExpressionWithNameArray(); break; - case 537 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ + case 540 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$ consumeOnlyTypeArgumentsForCastExpression(); break; - case 538 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ + case 541 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$ consumeInsideCastExpression(); break; - case 539 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ + case 542 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$ consumeInsideCastExpressionLL1(); break; - case 540 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ + case 543 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$ consumeInsideCastExpressionWithQualifiedGenerics(); break; - case 542 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ + case 545 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MULTIPLY); break; - case 543 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ + case 546 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.DIVIDE); break; - case 544 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ + case 547 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.REMAINDER); break; - case 546 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ + case 549 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.PLUS); break; - case 547 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ + case 550 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MINUS); break; - case 549 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ + case 552 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LEFT_SHIFT); break; - case 550 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ + case 553 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); break; - case 551 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ + case 554 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); break; - case 553 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ + case 556 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS); break; - case 554 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ + case 557 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER); break; - case 555 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ + case 558 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS_EQUAL); break; - case 556 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ + case 559 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER_EQUAL); break; - case 558 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ + case 561 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression instanceof"); } //$NON-NLS-1$ consumeInstanceOfExpression(); break; - case 560 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ + case 563 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); break; - case 561 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ + case 564 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.NOT_EQUAL); break; - case 563 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ + case 566 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND); break; - case 565 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ + case 568 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.XOR); break; - case 567 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ + case 570 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR); break; - case 569 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ + case 572 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND_AND); break; - case 571 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ + case 574 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR_OR); break; - case 573 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ + case 576 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$ consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; break; - case 576 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ + case 579 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$ consumeAssignment(); break; - case 578 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ + case 581 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$ ignoreExpressionAssignment(); break; - case 579 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ + case 582 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(EQUAL); break; - case 580 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ + case 583 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(MULTIPLY); break; - case 581 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ + case 584 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(DIVIDE); break; - case 582 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ + case 585 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(REMAINDER); break; - case 583 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ + case 586 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(PLUS); break; - case 584 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ + case 587 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(MINUS); break; - case 585 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ + case 588 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(LEFT_SHIFT); break; - case 586 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ + case 589 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(RIGHT_SHIFT); break; - case 587 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ + case 590 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT); break; - case 588 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ + case 591 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(AND); break; - case 589 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ + case 592 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(XOR); break; - case 590 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ + case 593 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$ consumeAssignmentOperator(OR); break; - case 594 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ + case 597 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$ consumeEmptyExpression(); break; - case 599 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ + case 602 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyClassBodyDeclarationsopt(); break; - case 600 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ + case 603 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ consumeClassBodyDeclarationsopt(); break; - case 601 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ + case 604 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$ consumeDefaultModifiers(); break; - case 602 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ + case 605 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$ consumeModifiers(); break; - case 603 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ + case 606 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$ consumeEmptyBlockStatementsopt(); break; - case 605 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ + case 608 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$ consumeEmptyDimsopt(); break; - case 607 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ + case 610 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$ consumeEmptyArgumentListopt(); break; - case 611 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ + case 614 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$ consumeFormalParameterListopt(); break; - case 615 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ + case 618 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyInterfaceMemberDeclarationsopt(); break; - case 616 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ + case 619 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ consumeInterfaceMemberDeclarationsopt(); break; - case 617 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ + case 620 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$ consumeNestedType(); break; - case 618 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ + case 621 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$ consumeEmptyForInitopt(); break; - case 620 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ + case 623 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$ consumeEmptyForUpdateopt(); break; - case 624 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ + case 627 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$ consumeEmptyCatchesopt(); break; - case 626 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ + case 629 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$ consumeEnumDeclaration(); break; - case 627 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ + case 630 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$ consumeEnumHeader(); break; - case 628 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ + case 631 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$ consumeEnumHeaderName(); break; - case 629 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ + case 632 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$ consumeEnumHeaderNameWithTypeParameters(); break; - case 630 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ + case 633 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$ consumeEnumBodyNoConstants(); break; - case 631 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ + case 634 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$ consumeEnumBodyNoConstants(); break; - case 632 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ + case 635 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$ consumeEnumBodyWithConstants(); break; - case 633 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ + case 636 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$ consumeEnumBodyWithConstants(); break; - case 635 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ + case 638 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$ consumeEnumConstants(); break; - case 636 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ + case 639 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$ consumeEnumConstantHeaderName(); break; - case 637 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ + case 640 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$ consumeEnumConstantHeader(); break; - case 638 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ + case 641 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$ consumeEnumConstantWithClassBody(); break; - case 639 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ + case 642 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$ consumeEnumConstantNoClassBody(); break; - case 640 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ + case 643 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$ consumeArguments(); break; - case 641 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ + case 644 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$ consumeEmptyArguments(); break; - case 643 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ + case 646 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$ consumeEnumDeclarations(); break; - case 644 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ + case 647 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyEnumDeclarations(); break; - case 646 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ + case 649 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$ consumeEnhancedForStatement(); break; - case 647 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ + case 650 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$ consumeEnhancedForStatement(); break; - case 648 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$ + case 651 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$ consumeEnhancedForStatementHeaderInit(false); break; - case 649 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ + case 652 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$ consumeEnhancedForStatementHeaderInit(true); break; - case 650 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ + case 653 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$ consumeEnhancedForStatementHeader(); break; - case 651 : if (DEBUG) { System.out.println("SingleBaseImportDeclaration ::=..."); } //$NON-NLS-1$ + case 654 : if (DEBUG) { System.out.println("SingleBaseImportDeclaration ::=..."); } //$NON-NLS-1$ consumeImportDeclaration(); break; - case 652 : if (DEBUG) { System.out.println("SingleBaseImportDeclarationName ::= import base Name"); } //$NON-NLS-1$ + case 655 : if (DEBUG) { System.out.println("SingleBaseImportDeclarationName ::= import base Name"); } //$NON-NLS-1$ consumeSingleBaseImportDeclarationName(); break; - case 653 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ + case 656 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$ consumeImportDeclaration(); break; - case 654 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ + case 657 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$ consumeSingleStaticImportDeclarationName(); break; - case 655 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ + case 658 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$ consumeImportDeclaration(); break; - case 656 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ + case 659 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$ consumeStaticImportOnDemandDeclarationName(); break; - case 657 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ + case 660 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ consumeTypeArguments(); break; - case 658 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ + case 661 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$ consumeOnlyTypeArguments(); break; - case 660 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ + case 663 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ consumeTypeArgumentList1(); break; - case 662 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ + case 665 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$ consumeTypeArgumentList(); break; - case 663 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ + case 666 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$ consumeTypeArgument(); break; - case 668 : if (DEBUG) { System.out.println("TypeAnchor ::= AT Name"); } //$NON-NLS-1$ + case 671 : if (DEBUG) { System.out.println("TypeAnchor ::= AT Name"); } //$NON-NLS-1$ consumeTypeAnchor(false); break; - case 669 : if (DEBUG) { System.out.println("TypeAnchor ::= AT base"); } //$NON-NLS-1$ + case 672 : if (DEBUG) { System.out.println("TypeAnchor ::= AT base"); } //$NON-NLS-1$ consumeTypeAnchor(true); break; - case 670 : if (DEBUG) { System.out.println("TypeAnchor ::= AT this"); } //$NON-NLS-1$ + case 673 : if (DEBUG) { System.out.println("TypeAnchor ::= AT this"); } //$NON-NLS-1$ skipThisAnchor(); break; - case 671 : if (DEBUG) { System.out.println("TypeAnchor ::= AT Name DOT base"); } //$NON-NLS-1$ + case 674 : if (DEBUG) { System.out.println("TypeAnchor ::= AT Name DOT base"); } //$NON-NLS-1$ consumeQualifiedBaseTypeAnchor(); break; - case 674 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ + case 677 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$ consumeReferenceType1(); break; - case 675 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ + case 678 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ consumeTypeArgumentReferenceType1(); break; - case 677 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ + case 680 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ consumeTypeArgumentList2(); break; - case 680 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ + case 683 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$ consumeReferenceType2(); break; - case 681 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ + case 684 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$ consumeTypeArgumentReferenceType2(); break; - case 683 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ + case 686 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$ consumeTypeArgumentList3(); break; - case 686 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ + case 689 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ consumeReferenceType3(); break; - case 687 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ + case 690 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION"); } //$NON-NLS-1$ consumeWildcard(); break; - case 688 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ + case 691 : if (DEBUG) { System.out.println("Wildcard ::= QUESTION WildcardBounds"); } //$NON-NLS-1$ consumeWildcardWithBounds(); break; - case 689 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ + case 692 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$ consumeWildcardBoundsExtends(); break; - case 690 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ + case 693 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$ consumeWildcardBoundsSuper(); break; - case 691 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ + case 694 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION GREATER"); } //$NON-NLS-1$ consumeWildcard1(); break; - case 692 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ + case 695 : if (DEBUG) { System.out.println("Wildcard1 ::= QUESTION WildcardBounds1"); } //$NON-NLS-1$ consumeWildcard1WithBounds(); break; - case 693 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ + case 696 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$ consumeWildcardBounds1Extends(); break; - case 694 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ + case 697 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$ consumeWildcardBounds1Super(); break; - case 695 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ + case 698 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$ consumeWildcard2(); break; - case 696 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ + case 699 : if (DEBUG) { System.out.println("Wildcard2 ::= QUESTION WildcardBounds2"); } //$NON-NLS-1$ consumeWildcard2WithBounds(); break; - case 697 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ + case 700 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$ consumeWildcardBounds2Extends(); break; - case 698 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ + case 701 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$ consumeWildcardBounds2Super(); break; - case 699 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ + case 702 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$ consumeWildcard3(); break; - case 700 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ + case 703 : if (DEBUG) { System.out.println("Wildcard3 ::= QUESTION WildcardBounds3"); } //$NON-NLS-1$ consumeWildcard3WithBounds(); break; - case 701 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ + case 704 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$ consumeWildcardBounds3Extends(); break; - case 702 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ + case 705 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$ consumeWildcardBounds3Super(); break; - case 703 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); } //$NON-NLS-1$ + case 706 : if (DEBUG) { System.out.println("TypeParameterHeader ::= Identifier"); } //$NON-NLS-1$ consumeTypeParameterHeader(); break; - case 704 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ + case 707 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$ consumeTypeParameters(); break; - case 706 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ + case 709 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ consumeTypeParameterList(); break; - case 708 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 711 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameterWithExtends(); break; - case 709 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 712 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameterWithExtendsAndBounds(); break; - case 710 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader base ReferenceType"); } //$NON-NLS-1$ + case 713 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader base ReferenceType"); } //$NON-NLS-1$ consumeTypeParameterWithBase(); break; - case 714 : if (DEBUG) { System.out.println("TypeValueParameter ::= TypeParameterHeader Identifier"); } //$NON-NLS-1$ + case 717 : if (DEBUG) { System.out.println("TypeValueParameter ::= TypeParameterHeader Identifier"); } //$NON-NLS-1$ consumeTypeValueParameter(); break; - case 719 : if (DEBUG) { System.out.println("TypeBoundOpt ::= extends ReferenceType"); } //$NON-NLS-1$ + case 722 : if (DEBUG) { System.out.println("TypeBoundOpt ::= extends ReferenceType"); } //$NON-NLS-1$ consumeBoundsOfAnchoredTypeParameter(); break; - case 721 : if (DEBUG) { System.out.println("TypeBoundOpt1 ::= extends ReferenceType1"); } //$NON-NLS-1$ + case 724 : if (DEBUG) { System.out.println("TypeBoundOpt1 ::= extends ReferenceType1"); } //$NON-NLS-1$ consumeBoundsOfAnchoredTypeParameter(); break; - case 722 : if (DEBUG) { System.out.println("AnchoredTypeParameterHeader0 ::= TypeParameterHeader..."); } //$NON-NLS-1$ + case 725 : if (DEBUG) { System.out.println("AnchoredTypeParameterHeader0 ::= TypeParameterHeader..."); } //$NON-NLS-1$ consumeAnchoredTypeParameter(); break; - case 724 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ + case 727 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$ consumeAdditionalBoundList(); break; - case 725 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ + case 728 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$ consumeAdditionalBound(); break; - case 727 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ + case 730 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$ consumeTypeParameterList1(); break; - case 728 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ + case 731 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$ consumeTypeParameter1(); break; - case 729 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 732 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameter1WithExtends(); break; - case 730 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader base..."); } //$NON-NLS-1$ + case 733 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader base..."); } //$NON-NLS-1$ consumeTypeParameter1WithBase(); break; - case 731 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ + case 734 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$ consumeTypeParameter1WithExtendsAndBounds(); break; - case 733 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ + case 736 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$ consumeAdditionalBoundList1(); break; - case 734 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ + case 737 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$ consumeAdditionalBound1(); break; - case 740 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ + case 743 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.PLUS); break; - case 741 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ + case 744 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.MINUS); break; - case 744 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ + case 747 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.TWIDDLE); break; - case 745 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ + case 748 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$ consumeUnaryExpression(OperatorIds.NOT); break; - case 748 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ + case 751 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MULTIPLY); break; - case 749 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ + case 752 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.MULTIPLY); break; - case 750 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ + case 753 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.DIVIDE); break; - case 751 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ + case 754 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.DIVIDE); break; - case 752 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ + case 755 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.REMAINDER); break; - case 753 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ + case 756 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.REMAINDER); break; - case 755 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ + case 758 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.PLUS); break; - case 756 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ + case 759 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.PLUS); break; - case 757 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ + case 760 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.MINUS); break; - case 758 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ + case 761 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.MINUS); break; - case 760 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ + case 763 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LEFT_SHIFT); break; - case 761 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ + case 764 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT); break; - case 762 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ + case 765 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.RIGHT_SHIFT); break; - case 763 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ + case 766 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT); break; - case 764 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ + case 767 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT); break; - case 765 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ + case 768 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT); break; - case 767 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ + case 770 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS); break; - case 768 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ + case 771 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.LESS); break; - case 769 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ + case 772 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= ShiftExpression_NotName"); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER); break; - case 770 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ + case 773 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.GREATER); break; - case 771 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ + case 774 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.LESS_EQUAL); break; - case 772 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ + case 775 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL); break; - case 773 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ + case 776 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.GREATER_EQUAL); break; - case 774 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ + case 777 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL); break; - case 776 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ + case 779 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name instanceof..."); } //$NON-NLS-1$ consumeInstanceOfExpressionWithName(); break; - case 777 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ + case 780 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$ consumeInstanceOfExpression(); break; - case 779 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ + case 782 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.EQUAL_EQUAL); break; - case 780 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ + case 783 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL); break; - case 781 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ + case 784 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$ consumeEqualityExpression(OperatorIds.NOT_EQUAL); break; - case 782 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ + case 785 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$ consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL); break; - case 784 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ + case 787 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND); break; - case 785 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ + case 788 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.AND); break; - case 787 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ + case 790 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.XOR); break; - case 788 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ + case 791 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR AndExpression"); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.XOR); break; - case 790 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ + case 793 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR); break; - case 791 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ + case 794 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.OR); break; - case 793 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ + case 796 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.AND_AND); break; - case 794 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ + case 797 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.AND_AND); break; - case 796 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ + case 799 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$ consumeBinaryExpression(OperatorIds.OR_OR); break; - case 797 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ + case 800 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$ consumeBinaryExpressionWithName(OperatorIds.OR_OR); break; - case 799 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ + case 802 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$ consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ; break; - case 800 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ + case 803 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$ consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ; break; - case 804 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ + case 807 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderName() ; break; - case 805 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ + case 808 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; break; - case 806 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ + case 809 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ; break; - case 807 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ + case 810 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeaderName() ; break; - case 808 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ + case 811 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclarationHeader() ; break; - case 809 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ + case 812 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeDeclaration() ; break; - case 811 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ + case 814 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$ consumeEmptyAnnotationTypeMemberDeclarationsopt() ; break; - case 812 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ + case 815 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$ consumeAnnotationTypeMemberDeclarationsopt() ; break; - case 814 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ + case 817 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeMemberDeclarations() ; break; - case 815 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ + case 818 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$ consumeMethodHeaderNameWithTypeParameters(true); break; - case 816 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ + case 819 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ consumeMethodHeaderName(true); break; - case 817 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ + case 820 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$ consumeEmptyMethodHeaderDefaultValue() ; break; - case 818 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ + case 821 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$ consumeMethodHeaderDefaultValue(); break; - case 819 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ + case 822 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName..."); } //$NON-NLS-1$ consumeMethodHeader(); break; - case 820 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ + case 823 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$ consumeAnnotationTypeMemberDeclaration() ; break; - case 828 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ + case 831 : if (DEBUG) { System.out.println("AnnotationName ::= AT Name"); } //$NON-NLS-1$ consumeAnnotationName() ; break; - case 829 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ + case 832 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ consumeNormalAnnotation() ; break; - case 830 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ + case 833 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$ consumeEmptyMemberValuePairsopt() ; break; - case 833 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ + case 836 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$ consumeMemberValuePairs() ; break; - case 834 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ + case 837 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue..."); } //$NON-NLS-1$ consumeMemberValuePair() ; break; - case 835 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ + case 838 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$ consumeEnterMemberValue() ; break; - case 836 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ + case 839 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$ consumeExitMemberValue() ; break; - case 838 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ + case 841 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$ consumeMemberValueAsName() ; break; - case 841 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 844 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeMemberValueArrayInitializer() ; break; - case 842 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 845 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeMemberValueArrayInitializer() ; break; - case 843 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 846 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeEmptyMemberValueArrayInitializer() ; break; - case 844 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ + case 847 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$ consumeEmptyMemberValueArrayInitializer() ; break; - case 845 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ + case 848 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$ consumeEnterMemberValueArrayInitializer() ; break; - case 847 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ + case 850 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$ consumeMemberValues() ; break; - case 848 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ + case 851 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$ consumeMarkerAnnotation() ; break; - case 849 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ + case 852 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$ consumeSingleMemberAnnotationMemberValue() ; break; - case 850 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ + case 853 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$ consumeSingleMemberAnnotation() ; break; - case 851 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ + case 854 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt TypeParameters"); } //$NON-NLS-1$ consumeRecoveryMethodHeaderNameWithTypeParameters(); break; - case 852 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ + case 855 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$ consumeRecoveryMethodHeaderName(); break; - case 853 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ + case 856 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ consumeMethodHeader(); break; - case 854 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ + case 857 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ consumeMethodHeader(); break; - case 857 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= RecoveryCallinBindingLeftLong"); } //$NON-NLS-1$ + case 860 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= RecoveryCallinBindingLeftLong"); } //$NON-NLS-1$ consumeCallinHeader(); break; - case 858 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$ + case 861 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$ consumeCallinHeader(); break; - case 859 : if (DEBUG) { System.out.println("RecoveryCallinBindingLeftLong ::= RecoveryMethodSpecLong"); } //$NON-NLS-1$ + case 862 : if (DEBUG) { System.out.println("RecoveryCallinBindingLeftLong ::= RecoveryMethodSpecLong"); } //$NON-NLS-1$ consumeCallinBindingLeft(true); break; - case 860 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt..."); } //$NON-NLS-1$ + case 863 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt..."); } //$NON-NLS-1$ consumeCallinHeader(); break; - case 861 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$ + case 864 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$ consumeCallinHeader(); break; - case 862 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= RecoveryCalloutBindingLeftLong"); } //$NON-NLS-1$ + case 865 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= RecoveryCalloutBindingLeftLong"); } //$NON-NLS-1$ consumeCalloutHeader(); break; - case 863 : if (DEBUG) { System.out.println("RecoveryCalloutBindingLeftLong ::=..."); } //$NON-NLS-1$ + case 866 : if (DEBUG) { System.out.println("RecoveryCalloutBindingLeftLong ::=..."); } //$NON-NLS-1$ consumeCalloutBindingLeft(true); break; - case 864 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= RecoveryCalloutBindingLeftLong"); } //$NON-NLS-1$ + case 867 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= RecoveryCalloutBindingLeftLong"); } //$NON-NLS-1$ consumeCalloutHeader(); break; - case 865 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= Modifiersopt..."); } //$NON-NLS-1$ + case 868 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= Modifiersopt..."); } //$NON-NLS-1$ consumeCalloutHeader(); break; - case 866 : if (DEBUG) { System.out.println("RecoveryMethodSpecLong ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ + case 869 : if (DEBUG) { System.out.println("RecoveryMethodSpecLong ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$ consumeMethodSpecLong(false); break; @@ -9389,6 +9402,8 @@ protected void consumeStaticImportOnDemandDeclarationName() { System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccStatic)); + // star end position + impt.trailingStarPosition = this.intStack[this.intPtr--]; this.modifiers = ClassFileConstants.AccDefault; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) @@ -9825,6 +9840,10 @@ protected void consumeToken(int type) { } } break; + case TokenNameMULTIPLY : + // star end position + pushOnIntStack(this.scanner.currentPosition - 1); + break; // case TokenNameCOMMA : // case TokenNameCOLON : // case TokenNameLBRACKET : @@ -10043,6 +10062,8 @@ protected void consumeTypeImportOnDemandDeclarationName() { System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccDefault)); + // star end position + impt.trailingStarPosition = this.intStack[this.intPtr--]; if (this.currentToken == TokenNameSEMICOLON){ impt.declarationSourceEnd = this.scanner.currentPosition - 1; } else { diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java index 5e6336ff7..c6c488255 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java @@ -22,15 +22,15 @@ public interface ParserBasicInformation { NT_OFFSET = 129, SCOPE_UBOUND = 191, SCOPE_SIZE = 192, - LA_STATE_OFFSET = 14764, + LA_STATE_OFFSET = 14581, MAX_LA = 1, - NUM_RULES = 866, + NUM_RULES = 869, NUM_TERMINALS = 129, - NUM_NON_TERMINALS = 383, - NUM_SYMBOLS = 512, - START_STATE = 1060, + NUM_NON_TERMINALS = 384, + NUM_SYMBOLS = 513, + START_STATE = 932, EOFT_SYMBOL = 73, EOLT_SYMBOL = 73, - ACCEPT_ACTION = 14763, - ERROR_ACTION = 14764; + ACCEPT_ACTION = 14580, + ERROR_ACTION = 14581; } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc Binary files differindex d68a9c2c2..5f8391326 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc Binary files differindex 8e817fe9f..8cb93d407 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc Binary files differindex 765d58697..599d5bf6f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc Binary files differindex 4b2ec1459..074593965 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc Binary files differindex 1c0e10326..ba3ffd0c0 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc Binary files differindex 4ccce1ad9..be8ab0ba7 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc Binary files differindex 2d355986d..451a1290c 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc Binary files differindex 5dc58b8c0..b8bda6ab4 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc Binary files differindex b8c0eebc2..5f00c38cd 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc Binary files differindex e5912c28a..bf5aca3c1 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc Binary files differindex c68073e5e..7bded405e 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc Binary files differindex afdbfc090..e12492e0f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc Binary files differindex b5200bba5..f63b20b08 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc Binary files differindex 4cb841805..08e28e091 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc Binary files differindex 2cdc219eb..d776ba04f 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc Binary files differindex dbd086f7b..8e3791bfc 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc Binary files differindex 14c721d8e..ab2c54020 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc Binary files differindex c0afae810..7691930e9 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties index c76f21591..5d0d56619 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.properties @@ -211,6 +211,7 @@ InvalidCallinBinding=InvalidCallinBinding InvalidCallinModifier=InvalidCallinModifier InvalidConstructorDeclaration=InvalidConstructorDeclaration InvalidDeclaredArrayLifting=InvalidDeclaredArrayLifting +InvalidInitializer=InvalidInitializer Label=Label LabeledStatement=LabeledStatement LabeledStatementNoShortIf=LabeledStatement diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java index 223b4a87b..1d9941686 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java @@ -28,16 +28,99 @@ import org.eclipse.jdt.core.compiler.CategorizedProblem; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.compiler.InvalidInputException; -import org.eclipse.jdt.internal.compiler.*; -import org.eclipse.jdt.internal.compiler.ast.*; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; +import org.eclipse.jdt.internal.compiler.IProblemFactory; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; +import org.eclipse.jdt.internal.compiler.ast.AllocationExpression; +import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Argument; +import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression; +import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference; +import org.eclipse.jdt.internal.compiler.ast.ArrayReference; +import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; +import org.eclipse.jdt.internal.compiler.ast.Assignment; +import org.eclipse.jdt.internal.compiler.ast.BinaryExpression; +import org.eclipse.jdt.internal.compiler.ast.Block; +import org.eclipse.jdt.internal.compiler.ast.BranchStatement; +import org.eclipse.jdt.internal.compiler.ast.CaseStatement; +import org.eclipse.jdt.internal.compiler.ast.CastExpression; +import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment; +import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression; +import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; +import org.eclipse.jdt.internal.compiler.ast.EqualExpression; +import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall; +import org.eclipse.jdt.internal.compiler.ast.Expression; +import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; +import org.eclipse.jdt.internal.compiler.ast.FieldReference; +import org.eclipse.jdt.internal.compiler.ast.ImportReference; +import org.eclipse.jdt.internal.compiler.ast.Initializer; +import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression; +import org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference; +import org.eclipse.jdt.internal.compiler.ast.LabeledStatement; +import org.eclipse.jdt.internal.compiler.ast.Literal; +import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; +import org.eclipse.jdt.internal.compiler.ast.MemberValuePair; +import org.eclipse.jdt.internal.compiler.ast.MessageSend; +import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.NameReference; +import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference; +import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference; +import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; +import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; +import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; +import org.eclipse.jdt.internal.compiler.ast.Reference; +import org.eclipse.jdt.internal.compiler.ast.ReturnStatement; +import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; +import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; +import org.eclipse.jdt.internal.compiler.ast.Statement; +import org.eclipse.jdt.internal.compiler.ast.SwitchStatement; +import org.eclipse.jdt.internal.compiler.ast.ThisReference; +import org.eclipse.jdt.internal.compiler.ast.TryStatement; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.ast.TypeParameter; +import org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.eclipse.jdt.internal.compiler.ast.UnaryExpression; +import org.eclipse.jdt.internal.compiler.ast.Wildcard; import org.eclipse.jdt.internal.compiler.ast.Expression.DecapsulationState; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.AccessRestriction; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; -import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.parser.*; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.InvocationSite; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MemberTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; +import org.eclipse.jdt.internal.compiler.parser.JavadocTagConstants; +import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner; +import org.eclipse.jdt.internal.compiler.parser.Scanner; +import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; import org.eclipse.jdt.internal.compiler.util.Messages; import org.eclipse.objectteams.otdt.core.compiler.IOTConstants; import org.eclipse.objectteams.otdt.core.compiler.OTNameUtils; @@ -1178,7 +1261,7 @@ public void cannotReadSource(CompilationUnitDeclaration unit, AbortCompilationUn if (encoding == null) { encoding = System.getProperty("file.encoding"); //$NON-NLS-1$ } - String[] arguments = new String[]{ fileName, encoding, }; + String[] arguments = new String[]{ fileName, encoding }; this.handle( IProblem.InvalidEncoding, arguments, @@ -1191,13 +1274,15 @@ public void cannotReadSource(CompilationUnitDeclaration unit, AbortCompilationUn PrintWriter writer = new PrintWriter(stringWriter); if (verbose) { abortException.exception.printStackTrace(writer); - } else { - writer.print(abortException.exception.getClass().getName()); - writer.print(':'); - writer.print(abortException.exception.getMessage()); + System.err.println(stringWriter.toString()); + stringWriter = new StringWriter(); + writer = new PrintWriter(stringWriter); } + writer.print(abortException.exception.getClass().getName()); + writer.print(':'); + writer.print(abortException.exception.getMessage()); String exceptionTrace = stringWriter.toString(); - String[] arguments = new String[]{ fileName, exceptionTrace, }; + String[] arguments = new String[]{ fileName, exceptionTrace }; this.handle( IProblem.CannotReadSource, arguments, @@ -2950,7 +3035,7 @@ public void indirectAccessToStaticMethod(ASTNode location, MethodBinding method) location.sourceStart, location.sourceEnd); } -public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { +private void inheritedMethodReducesVisibility(int sourceStart, int sourceEnd, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { StringBuffer concreteSignature = new StringBuffer(); concreteSignature .append(concreteMethod.declaringClass.readableName()) @@ -2970,8 +3055,14 @@ public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBindi new String[] { shortSignature.toString(), new String(abstractMethods[0].declaringClass.shortReadableName())}, - type.sourceStart(), - type.sourceEnd()); + sourceStart, + sourceEnd); +} +public void inheritedMethodReducesVisibility(SourceTypeBinding type, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { + inheritedMethodReducesVisibility(type.sourceStart(), type.sourceEnd(), concreteMethod, abstractMethods); +} +public void inheritedMethodReducesVisibility(TypeParameter typeParameter, MethodBinding concreteMethod, MethodBinding[] abstractMethods) { + inheritedMethodReducesVisibility(typeParameter.sourceStart(), typeParameter.sourceEnd(), concreteMethod, abstractMethods); } public void inheritedMethodsHaveIncompatibleReturnTypes(ASTNode location, MethodBinding[] inheritedMethods, int length) { StringBuffer methodSignatures = new StringBuffer(); @@ -3073,8 +3164,8 @@ public void interfaceCannotHaveConstructors(ConstructorDeclaration constructor) constructor, constructor.compilationResult()); } -public void interfaceCannotHaveInitializers(SourceTypeBinding type, FieldDeclaration fieldDecl) { - String[] arguments = new String[] {new String(type.sourceName())}; +public void interfaceCannotHaveInitializers(char [] sourceName, FieldDeclaration fieldDecl) { + String[] arguments = new String[] {new String(sourceName)}; this.handle( IProblem.InterfaceCannotHaveInitializers, @@ -4137,8 +4228,13 @@ public void invalidType(ASTNode location, TypeBinding type) { if (type.isParameterizedType()) { List missingTypes = type.collectMissingTypes(null); if (missingTypes != null) { + ReferenceContext savedContext = this.referenceContext; for (Iterator iterator = missingTypes.iterator(); iterator.hasNext(); ) { - invalidType(location, (TypeBinding) iterator.next()); + try { + invalidType(location, (TypeBinding) iterator.next()); + } finally { + this.referenceContext = savedContext; + } } return; } @@ -4187,10 +4283,10 @@ public void invalidType(ASTNode location, TypeBinding type) { break; case ProblemReasons.NonStaticReferenceInStaticContext : id = IProblem.NonStaticTypeFromStaticInvocation; - break; + break; case ProblemReasons.IllegalSuperTypeVariable : - id = IProblem.IllegalTypeVariableSuperReference; - break; + id = IProblem.IllegalTypeVariableSuperReference; + break; //{ObjectTeams: case ProblemReasons.AnchorNotFinal: ITeamAnchor anchor = null; @@ -5679,6 +5775,10 @@ public void missingSynchronizedOnInheritedMethod(MethodBinding currentMethod, Me } public void missingTypeInConstructor(ASTNode location, MethodBinding constructor) { List missingTypes = constructor.collectMissingTypes(null); + if (missingTypes == null) { + System.err.println("The constructor " + constructor + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } TypeBinding missingType = (TypeBinding) missingTypes.get(0); int start = location.sourceStart; int end = location.sourceEnd; @@ -5707,6 +5807,10 @@ public void missingTypeInConstructor(ASTNode location, MethodBinding constructor public void missingTypeInMethod(MessageSend messageSend, MethodBinding method) { List missingTypes = method.collectMissingTypes(null); + if (missingTypes == null) { + System.err.println("The method " + method + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$ + return; + } TypeBinding missingType = (TypeBinding) missingTypes.get(0); this.handle( IProblem.MissingTypeInMethod, @@ -6596,6 +6700,7 @@ public void rawMemberTypeCannotBeParameterized(ASTNode location, ReferenceBindin location.sourceEnd); } public void rawTypeReference(ASTNode location, TypeBinding type) { + if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 //{ObjectTeams: don't report useless case: CompilationResult result = this.referenceContext.compilationResult(); if (result.problems != null) @@ -7068,6 +7173,22 @@ public void tooManyMethods(TypeDeclaration typeDeclaration) { typeDeclaration.sourceStart, typeDeclaration.sourceEnd); } +public void tooManyParametersForSyntheticMethod(AbstractMethodDeclaration method) { + MethodBinding binding = method.binding; + String selector = null; + if (binding.isConstructor()) { + selector = new String(binding.declaringClass.sourceName()); + } else { + selector = new String(method.selector); + } + this.handle( + IProblem.TooManyParametersForSyntheticMethod, + new String[] {selector, typesAsString(binding.isVarargs(), binding.parameters, false), new String(binding.declaringClass.readableName()), }, + new String[] {selector, typesAsString(binding.isVarargs(), binding.parameters, true), new String(binding.declaringClass.shortReadableName()),}, + ProblemSeverities.AbortMethod | ProblemSeverities.Error | ProblemSeverities.Fatal, + method.sourceStart, + method.sourceEnd); +} public void typeCastError(CastExpression expression, TypeBinding leftType, TypeBinding rightType) { String leftName = new String(leftType.readableName()); String rightName = new String(rightType.readableName()); @@ -7241,9 +7362,10 @@ public void typeMismatchError(TypeBinding typeArgument, TypeVariableBinding type typeParamName = typeParameter.sourceName; else typeParamName = typeParameter.readableName(); +// orig: this.handle( IProblem.TypeArgumentMismatch, -/* orig: +/* new String[] { new String(typeArgument.readableName()), new String(genericType.readableName()), new String(typeParameter.sourceName), parameterBoundAsString(typeParameter, false) }, new String[] { new String(typeArgument.shortReadableName()), new String(genericType.shortReadableName()), new String(typeParameter.sourceName), parameterBoundAsString(typeParameter, true) }, :giro */ @@ -7374,6 +7496,7 @@ public void uninitializedBlankFinalField(FieldBinding field, ASTNode location) { nodeSourceEnd(field, location)); } public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) { + binding.tagBits |= TagBits.NotInitialized; String[] arguments = new String[] {new String(binding.readableName())}; this.handle( IProblem.UninitializedLocalVariable, @@ -7528,6 +7651,7 @@ public void unresolvableReference(NameReference nameRef, Binding binding) { */ String[] arguments = new String[] {new String(binding.readableName())}; int end = nameRef.sourceEnd; + int sourceStart = nameRef.sourceStart; if (nameRef instanceof QualifiedNameReference) { QualifiedNameReference ref = (QualifiedNameReference) nameRef; if (isRecoveredName(ref.tokens)) return; @@ -7536,6 +7660,11 @@ public void unresolvableReference(NameReference nameRef, Binding binding) { } else { SingleNameReference ref = (SingleNameReference) nameRef; if (isRecoveredName(ref.token)) return; + int numberOfParens = (ref.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT; + if (numberOfParens != 0) { + sourceStart = retrieveStartingPositionAfterOpeningParenthesis(sourceStart, end, numberOfParens); + end = retrieveEndingPositionAfterOpeningParenthesis(sourceStart, end, numberOfParens); + } } //{ObjectTeams: perhaps missing signature in callin mapping to pass args to predicate? if (this.referenceContext instanceof GuardPredicateDeclaration) { @@ -7554,10 +7683,11 @@ public void unresolvableReference(NameReference nameRef, Binding binding) { problemId, arguments, arguments, - nameRef.sourceStart, + sourceStart, end); } public void unsafeCast(CastExpression castExpression, Scope scope) { + if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 int severity = computeSeverity(IProblem.UnsafeGenericCast); if (severity == ProblemSeverities.Ignore) return; TypeBinding castedExpressionType = castExpression.expression.resolvedType; @@ -7588,6 +7718,7 @@ public void unsafeGenericArrayForVarargs(TypeBinding leafComponentType, ASTNode location.sourceEnd); } public void unsafeRawFieldAssignment(FieldBinding field, TypeBinding expressionType, ASTNode location) { + if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 int severity = computeSeverity(IProblem.UnsafeRawFieldAssignment); if (severity == ProblemSeverities.Ignore) return; this.handle( @@ -7601,6 +7732,7 @@ public void unsafeRawFieldAssignment(FieldBinding field, TypeBinding expressionT nodeSourceEnd(field, location)); } public void unsafeRawGenericMethodInvocation(ASTNode location, MethodBinding rawMethod, TypeBinding[] argumentTypes) { + if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 boolean isConstructor = rawMethod.isConstructor(); int severity = computeSeverity(isConstructor ? IProblem.UnsafeRawGenericConstructorInvocation : IProblem.UnsafeRawGenericMethodInvocation); if (severity == ProblemSeverities.Ignore) return; @@ -7643,6 +7775,7 @@ public void unsafeRawGenericMethodInvocation(ASTNode location, MethodBinding raw } } public void unsafeRawInvocation(ASTNode location, MethodBinding rawMethod) { + if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 boolean isConstructor = rawMethod.isConstructor(); int severity = computeSeverity(isConstructor ? IProblem.UnsafeRawConstructorInvocation : IProblem.UnsafeRawMethodInvocation); if (severity == ProblemSeverities.Ignore) return; @@ -7717,6 +7850,7 @@ public void unsafeReturnTypeOverride(MethodBinding currentMethod, MethodBinding end); } public void unsafeTypeConversion(Expression expression, TypeBinding expressionType, TypeBinding expectedType) { + if (this.options.sourceLevel < ClassFileConstants.JDK1_5) return; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 int severity = computeSeverity(IProblem.UnsafeTypeConversion); if (severity == ProblemSeverities.Ignore) return; this.handle( diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties index 9d58e2f51..c60df4e20 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties @@ -372,6 +372,7 @@ 432 = Too many fields for type {0}. Maximum is 65535 433 = Too many methods for type {0}. Maximum is 65535 +434 = The synthetic method created to access {0}({1}) of type {2} has too many parameters 440 = 'assert' should not be used as an identifier, since it is a reserved keyword from source level 1.4 on 441 = 'enum' should not be used as an identifier, since it is a reserved keyword from source level 1.5 on diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java index f5b686631..490730a42 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java @@ -553,7 +553,17 @@ public class Util implements SuffixConstants { } } } - + public static int hashCode(Object[] array) { + int prime = 31; + if (array == null) { + return 0; + } + int result = 1; + for (int index = 0; index < array.length; index++) { + result = prime * result + (array[index] == null ? 0 : array[index].hashCode()); + } + return result; + } /** * Returns whether the given name is potentially a zip archive file name * (it has a file extension and it is not ".java" nor ".class") diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/FieldAccessSpec.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/FieldAccessSpec.java index 5137d65f2..8f0500a23 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/FieldAccessSpec.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/FieldAccessSpec.java @@ -385,4 +385,12 @@ public class FieldAccessSpec extends MethodSpec implements InvocationSite { public void setFieldIndex(int depth) { // ignored } + + /** + * Used for generic method resolving, however, FieldAccessSpec is not an invocationSite used for invoking generic methods. + * (we implement InvocationSite only for visibility checking). + */ + public TypeBinding expectedType() { + return null; + } } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java index b0616a093..ef4d23881 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java @@ -1138,6 +1138,7 @@ public final class AST { * <li><code>"long"</code></li> * <li><code>"short"</code></li> * <li><code>"void"</code></li> + * <li><code>"java.lang.AssertionError"</code> (since 3.7)</li> * <li><code>"java.lang.Boolean"</code> (since 3.1)</li> * <li><code>"java.lang.Byte"</code> (since 3.1)</li> * <li><code>"java.lang.Character"</code> (since 3.1)</li> diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java index c531e5bf5..22cd7bafb 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -89,11 +89,11 @@ public class ASTMatcher { * </p> * * @param list1 the first list of AST nodes - * (element type: <code>ASTNode</code>) + * (element type: {@link ASTNode}) * @param list2 the second list of AST nodes - * (element type: <code>ASTNode</code>) + * (element type: {@link ASTNode}) * @return <code>true</code> if the lists have the same number of elements - * and match pair-wise according to <code>ASTNode.subtreeMatch</code> + * and match pair-wise according to {@link ASTNode#subtreeMatch(ASTMatcher, Object) ASTNode.subtreeMatch} * @see ASTNode#subtreeMatch(ASTMatcher matcher, Object other) */ public final boolean safeSubtreeListMatch(List list1, List list2) { diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java index 812bbee0d..648e84d0a 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -1232,7 +1232,7 @@ public abstract class ASTNode { /** * The underlying list in which the nodes of this list are - * stored (element type: <code>ASTNode</code>). + * stored (element type: {@link ASTNode}). * <p> * Be stingy on storage - assume that list will be empty. * </p> @@ -1304,7 +1304,7 @@ public abstract class ASTNode { /** * A list of currently active cursors (element type: - * <code>Cursor</code>), or <code>null</code> if there are no + * {@link Cursor}), or <code>null</code> if there are no * active cursors. * <p> * It is important for storage considerations to maintain the @@ -1886,7 +1886,7 @@ public abstract class ASTNode { * @param propertyList list beginning with the AST node class * followed by accumulated structural property descriptors * @return unmodifiable list of structural property descriptors - * (element type: <code>StructuralPropertyDescriptor</code>) + * (element type: {@link StructuralPropertyDescriptor}) */ static List reapPropertyList(List propertyList) { propertyList.remove(0); // remove nodeClass @@ -2539,9 +2539,9 @@ public abstract class ASTNode { * * @param target the AST that is to own the nodes in the result * @param nodes the list of nodes to copy - * (element type: <code>ASTNode</code>) + * (element type: {@link ASTNode}) * @return the list of copied subtrees - * (element type: <code>ASTNode</code>) + * (element type: {@link ASTNode}) */ public static List copySubtrees(AST target, List nodes) { List result = new ArrayList(nodes.size()); diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java index 1cc2abcdb..3084448bc 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -30,14 +30,14 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { /** * The type name; lazily initialized; defaults to a unspecified, * legal Java class identifier. - * @since 2.0 (originally declared on <code>TypeDeclaration</code>) + * @since 2.0 (originally declared on {@link TypeDeclaration}) */ SimpleName typeName = null; /** - * The body declarations (element type: <code>BodyDeclaration</code>). + * The body declarations (element type: {@link BodyDeclaration}). * Defaults to an empty list. - * @since 2.0 (originally declared on <code>TypeDeclaration</code>) + * @since 2.0 (originally declared on {@link TypeDeclaration}) */ ASTNode.NodeList bodyDeclarations; @@ -81,7 +81,7 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { /** * Creates and returns a structural property descriptor for the - * "bodyDeclaration" property declared on the given concrete node type. + * "bodyDeclaration" property declared on the given concrete node type (element type: {@link BodyDeclaration}). * * @return the property descriptor */ @@ -91,7 +91,7 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { /** * Creates and returns a structural property descriptor for the - * "name" property declared on the given concrete node type. + * "name" property declared on the given concrete node type (child type: {@link SimpleName}). * * @return the property descriptor */ @@ -119,7 +119,7 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { * Returns the name of the type declared in this type declaration. * * @return the type name node - * @since 2.0 (originally declared on <code>TypeDeclaration</code>) + * @since 2.0 (originally declared on {@link TypeDeclaration}) */ public SimpleName getName() { if (this.typeName == null) { @@ -145,7 +145,7 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { * <li>the node belongs to a different AST</li> * <li>the node already has a parent</li> * </ul> - * @since 2.0 (originally declared on <code>TypeDeclaration</code>) + * @since 2.0 (originally declared on {@link TypeDeclaration}) */ public void setName(SimpleName typeName) { if (typeName == null) { @@ -163,8 +163,8 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { * declaration. * * @return the live list of body declarations - * (element type: <code>BodyDeclaration</code>) - * @since 2.0 (originally declared on <code>TypeDeclaration</code>) + * (element type: {@link BodyDeclaration}) + * @since 2.0 (originally declared on {@link TypeDeclaration}) */ public List bodyDeclarations() { return this.bodyDeclarations; @@ -180,7 +180,7 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { * * @return <code>true</code> if this type declaration is a child of * a compilation unit node, and <code>false</code> otherwise - * @since 2.0 (originally declared on <code>TypeDeclaration</code>) + * @since 2.0 (originally declared on {@link TypeDeclaration}) */ public boolean isPackageMemberTypeDeclaration() { ASTNode parent = getParent(); @@ -198,7 +198,7 @@ public abstract class AbstractTypeDeclaration extends BodyDeclaration { * @return <code>true</code> if this type declaration is a child of * a type declaration node or an anonymous class declaration node, * and <code>false</code> otherwise - * @since 2.0 (originally declared on <code>TypeDeclaration</code>) + * @since 2.0 (originally declared on {@link TypeDeclaration}) */ public boolean isMemberTypeDeclaration() { ASTNode parent = getParent(); diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Annotation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Annotation.java index fd159119d..ef6f80b64 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Annotation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Annotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -44,7 +44,7 @@ public abstract class Annotation extends Expression implements IExtendedModifier /** * Creates and returns a structural property descriptor for the - * "typeName" property declared on the given concrete node type. + * "typeName" property declared on the given concrete node type (child type: {@link Name}). * * @return the property descriptor */ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java index f716936b8..ba0f27d6a 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -52,19 +52,19 @@ public class AnnotationTypeMemberDeclaration extends BodyDeclaration { internalModifiers2PropertyFactory(AnnotationTypeMemberDeclaration.class); /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(AnnotationTypeMemberDeclaration.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(AnnotationTypeMemberDeclaration.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "default" structural property of this node type. + * The "default" structural property of this node type (child type: {@link Expression}). */ public static final ChildPropertyDescriptor DEFAULT_PROPERTY = new ChildPropertyDescriptor(AnnotationTypeMemberDeclaration.class, "default", Expression.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java index 23852df48..14d4caf2c 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -32,7 +32,7 @@ import java.util.List; public class AnonymousClassDeclaration extends ASTNode { /** - * The "bodyDeclarations" structural property of this node type. + * The "bodyDeclarations" structural property of this node type (element type: {@link BodyDeclaration}). * @since 3.0 */ public static final ChildListPropertyDescriptor BODY_DECLARATIONS_PROPERTY = @@ -68,7 +68,7 @@ public class AnonymousClassDeclaration extends ASTNode { } /** - * The body declarations (element type: <code>BodyDeclaration</code>). + * The body declarations (element type: {@link BodyDeclaration}). * Defaults to none. */ private ASTNode.NodeList bodyDeclarations = @@ -150,7 +150,7 @@ public class AnonymousClassDeclaration extends ASTNode { * anonymous class declaration. * * @return the live list of body declarations - * (element type: <code>BodyDeclaration</code>) + * (element type: {@link BodyDeclaration}) */ public List bodyDeclarations() { return this.bodyDeclarations; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayAccess.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayAccess.java index 07a3b0d52..9f173c2d1 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayAccess.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayAccess.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,14 +28,14 @@ import java.util.List; public class ArrayAccess extends Expression { /** - * The "array" structural property of this node type. + * The "array" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor ARRAY_PROPERTY = new ChildPropertyDescriptor(ArrayAccess.class, "array", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "index" structural property of this node type. + * The "index" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor INDEX_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java index cca1072ba..f9577a56b 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -49,21 +49,21 @@ import java.util.List; public class ArrayCreation extends Expression { /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link ArrayType}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(ArrayCreation.class, "type", ArrayType.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "dimensions" structural property of this node type. + * The "dimensions" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor DIMENSIONS_PROPERTY = new ChildListPropertyDescriptor(ArrayCreation.class, "dimensions", Expression.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "initializer" structural property of this node type. + * The "initializer" structural property of this node type (child type: {@link ArrayInitializer}). * @since 3.0 */ public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = @@ -108,7 +108,7 @@ public class ArrayCreation extends Expression { /** * The list of dimension expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList dimensions = new ASTNode.NodeList(DIMENSIONS_PROPERTY); @@ -261,7 +261,7 @@ public class ArrayCreation extends Expression { * initializer. * * @return the live list of dimension expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List dimensions() { return this.dimensions; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java index ee91f5f91..f2c115d28 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class ArrayInitializer extends Expression { /** - * The "expressions" structural property of this node type. + * The "expressions" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor EXPRESSIONS_PROPERTY = @@ -65,7 +65,7 @@ public class ArrayInitializer extends Expression { /** * The list of expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList expressions = new ASTNode.NodeList(EXPRESSIONS_PROPERTY); @@ -138,7 +138,7 @@ public class ArrayInitializer extends Expression { * Returns the live ordered list of expressions in this array initializer. * * @return the live list of expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List expressions() { return this.expressions; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java index adceb01ba..0c7defb11 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -30,7 +30,7 @@ import java.util.List; public class ArrayType extends Type { /** - * The "componentType" structural property of this node type. + * The "componentType" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor COMPONENT_TYPE_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AssertStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AssertStatement.java index 88857cd6b..6c71fa6bc 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AssertStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AssertStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,14 +28,14 @@ import java.util.List; public class AssertStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(AssertStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "message" structural property of this node type. + * The "message" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor MESSAGE_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java index bc19c3f1e..3a6542c60 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -148,21 +148,21 @@ public class Assignment extends Expression { } /** - * The "leftHandSide" structural property of this node type. + * The "leftHandSide" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor LEFT_HAND_SIDE_PROPERTY = new ChildPropertyDescriptor(Assignment.class, "leftHandSide", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "operator" structural property of this node type. + * The "operator" structural property of this node type (type: {@link Assignment.Operator}). * @since 3.0 */ public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor(Assignment.class, "operator", Assignment.Operator.class, MANDATORY); //$NON-NLS-1$ /** - * The "rightHandSide" structural property of this node type. + * The "rightHandSide" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor RIGHT_HAND_SIDE_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java index b5921c207..2c13e897f 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class Block extends Statement { /** - * The "statements" structural property of this node type. + * The "statements" structural property of this node type (element type: {@link Statement}). * @since 3.0 */ public static final ChildListPropertyDescriptor STATEMENTS_PROPERTY = @@ -63,7 +63,7 @@ public class Block extends Statement { } /** - * The list of statements (element type: <code>Statement</code>). + * The list of statements (element type: {@link Statement}). * Defaults to an empty list. */ private ASTNode.NodeList statements = @@ -146,7 +146,7 @@ public class Block extends Statement { * exception. * * @return the live list of statements in this block - * (element type: <code>Statement</code>) + * (element type: {@link Statement}) */ public List statements() { return this.statements; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BodyDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BodyDeclaration.java index dd9ca6b0c..8f84cf097 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BodyDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BodyDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -70,7 +70,7 @@ public abstract class BodyDeclaration extends ASTNode { private int modifierFlags = Modifier.NONE; /** - * The extended modifiers (element type: <code>IExtendedModifier</code>). + * The extended modifiers (element type: {@link IExtendedModifier}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @@ -127,7 +127,7 @@ public abstract class BodyDeclaration extends ASTNode { /** * Creates and returns a structural property descriptor for the - * "javadoc" property declared on the given concrete node type. + * "javadoc" property declared on the given concrete node type (child type: {@link Javadoc}). * * @return the property descriptor */ @@ -137,7 +137,7 @@ public abstract class BodyDeclaration extends ASTNode { /** * Creates and returns a structural property descriptor for the - * "modifiers" property declared on the given concrete node type. + * "modifiers" property declared on the given concrete node type (type: {@link Integer}). * * @return the property descriptor */ @@ -147,7 +147,7 @@ public abstract class BodyDeclaration extends ASTNode { /** * Creates and returns a structural property descriptor for the - * "modifiers" property declared on the given concrete node type. + * "modifiers" property declared on the given concrete node type (element type: {@link IExtendedModifier}). * * @return the property descriptor */ @@ -259,7 +259,7 @@ public abstract class BodyDeclaration extends ASTNode { * of this declaration (added in JLS3 API). * * @return the live list of modifiers and annotations - * (element type: <code>IExtendedModifier</code>) + * (element type: {@link IExtendedModifier}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BooleanLiteral.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BooleanLiteral.java index 7cc80cfe1..c36029712 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BooleanLiteral.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BooleanLiteral.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -29,7 +29,7 @@ import java.util.List; public class BooleanLiteral extends Expression { /** - * The "booleanValue" structural property of this node type. + * The "booleanValue" structural property of this node type (type: {@link Boolean}). * @since 3.0 */ public static final SimplePropertyDescriptor BOOLEAN_VALUE_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java index 2f0c046e0..1b0e2f41f 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class BreakStatement extends Statement { /** - * The "label" structural property of this node type. + * The "label" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor LABEL_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CastExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CastExpression.java index ca2b07b34..a11e0e006 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CastExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CastExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,14 +28,14 @@ import java.util.List; public class CastExpression extends Expression { /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(CastExpression.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CatchClause.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CatchClause.java index 9c7dafa34..c5ecb4539 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CatchClause.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CatchClause.java @@ -29,14 +29,14 @@ import java.util.List; public class CatchClause extends ASTNode { /** - * The "exception" structural property of this node type. + * The "exception" structural property of this node type (child type: {@link SingleVariableDeclaration}). * @since 3.0 */ public static final ChildPropertyDescriptor EXCEPTION_PROPERTY = new ChildPropertyDescriptor(CatchClause.class, "exception", SingleVariableDeclaration.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Block}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java index 456fdbbcc..a932a708f 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; public class CharacterLiteral extends Expression { /** - * The "escapedValue" structural property of this node type. + * The "escapedValue" structural property of this node type (type: {@link String}). * @since 3.0 */ public static final SimplePropertyDescriptor ESCAPED_VALUE_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java index e95d569fb..7dfaa4cff 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -63,42 +63,42 @@ import java.util.List; public class ClassInstanceCreation extends Expression { /** - * The "typeArguments" structural property of this node type (added in JLS3 API). + * The "typeArguments" structural property of this node type (element type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(ClassInstanceCreation.class, "typeArguments", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(ClassInstanceCreation.class, "expression", Expression.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type (JLS2 API only). + * The "name" structural property of this node type (child type: {@link Name}) (JLS2 API only). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(ClassInstanceCreation.class, "name", Name.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "type" structural property of this node type (added in JLS3 API). + * The "type" structural property of this node type (child type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(ClassInstanceCreation.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "arguments" structural property of this node type. + * The "arguments" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(ClassInstanceCreation.class, "arguments", Expression.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "anonymousClassDeclaration" structural property of this node type. + * The "anonymousClassDeclaration" structural property of this node type (child type: {@link AnonymousClassDeclaration}). * @since 3.0 */ public static final ChildPropertyDescriptor ANONYMOUS_CLASS_DECLARATION_PROPERTY = @@ -164,7 +164,7 @@ public class ClassInstanceCreation extends Expression { private Expression optionalExpression = null; /** - * The type arguments (element type: <code>Type</code>). + * The type arguments (element type: {@link Type}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -185,7 +185,7 @@ public class ClassInstanceCreation extends Expression { /** * The list of argument expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList arguments = new ASTNode.NodeList(ARGUMENTS_PROPERTY); @@ -373,7 +373,7 @@ public class ClassInstanceCreation extends Expression { * instance creation (added in JLS3 API). * * @return the live list of type arguments - * (element type: <code>Type</code>) + * (element type: {@link Type}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -511,7 +511,7 @@ public class ClassInstanceCreation extends Expression { * instance creation expression. * * @return the live list of argument expressions (possibly empty) - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List arguments() { return this.arguments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java index 6d868aeed..6b05aea7c 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -63,7 +63,7 @@ public class CompilationUnit extends ASTNode { private static final IProblem[] EMPTY_PROBLEMS = new IProblem[0]; /** - * The "imports" structural property of this node type. + * The "imports" structural property of this node type (element type: {@link ImportDeclaration}). * * @since 3.0 */ @@ -71,7 +71,7 @@ public class CompilationUnit extends ASTNode { new ChildListPropertyDescriptor(CompilationUnit.class, "imports", ImportDeclaration.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "package" structural property of this node type. + * The "package" structural property of this node type (child type: {@link PackageDeclaration}). * * @since 3.0 */ @@ -87,7 +87,7 @@ public class CompilationUnit extends ASTNode { private static final List PROPERTY_DESCRIPTORS; /** - * The "types" structural property of this node type. + * The "types" structural property of this node type (element type: {@link AbstractTypeDeclaration}). * * @since 3.0 */ @@ -154,7 +154,7 @@ public class CompilationUnit extends ASTNode { private Message[] messages; /** - * The comment list (element type: <code>Comment</code>, + * The comment list (element type: {@link Comment}, * or <code>null</code> if none; initially <code>null</code>. * @since 3.0 */ @@ -902,7 +902,7 @@ public class CompilationUnit extends ASTNode { * on record. Subsequence modifications made to the AST * are added to the ones already on record. If this method * is called again later, the resulting text edit object will - * accurately reflect the net cumulative affect of all those + * accurately reflect the net cumulative effect of all those * changes. * </p> * diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java index a08f7bbe2..72e02f56e 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java @@ -58,7 +58,7 @@ import org.eclipse.jdt.internal.compiler.util.Util; import org.eclipse.jdt.internal.core.BinaryMember; import org.eclipse.jdt.internal.core.CancelableNameEnvironment; import org.eclipse.jdt.internal.core.CancelableProblemFactory; -import org.eclipse.jdt.internal.core.INameEnviromentWithProgress; +import org.eclipse.jdt.internal.core.INameEnvironmentWithProgress; import org.eclipse.jdt.internal.core.JavaProject; import org.eclipse.jdt.internal.core.NameLookup; import org.eclipse.jdt.internal.core.SourceRefElement; @@ -615,7 +615,7 @@ class CompilationUnitResolver extends Compiler { int flags, IProgressMonitor monitor) { - INameEnviromentWithProgress environment = null; + INameEnvironmentWithProgress environment = null; CancelableProblemFactory problemFactory = null; try { if (monitor != null) { @@ -624,7 +624,7 @@ class CompilationUnitResolver extends Compiler { } Classpath[] allEntries = new Classpath[classpaths.size()]; classpaths.toArray(allEntries); - environment = new NameEnviromentWithProgress(allEntries, null, monitor); + environment = new NameEnvironmentWithProgress(allEntries, null, monitor); problemFactory = new CancelableProblemFactory(monitor); CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0); compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0; @@ -664,14 +664,14 @@ class CompilationUnitResolver extends Compiler { IProgressMonitor monitor) throws JavaModelException { CompilationUnitDeclaration unit = null; - INameEnviromentWithProgress environment = null; + INameEnvironmentWithProgress environment = null; CancelableProblemFactory problemFactory = null; CompilationUnitResolver resolver = null; try { if (javaProject == null) { Classpath[] allEntries = new Classpath[classpaths.size()]; classpaths.toArray(allEntries); - environment = new NameEnviromentWithProgress(allEntries, null, monitor); + environment = new NameEnvironmentWithProgress(allEntries, null, monitor); } else { environment = new CancelableNameEnvironment((JavaProject) javaProject, owner, monitor); } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConditionalExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConditionalExpression.java index 8228fde81..84696c62e 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConditionalExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConditionalExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,21 +28,21 @@ import java.util.List; public class ConditionalExpression extends Expression { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(ConditionalExpression.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "thenExpression" structural property of this node type. + * The "thenExpression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor THEN_EXPRESSION_PROPERTY = new ChildPropertyDescriptor(ConditionalExpression.class, "thenExpression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "elseExpression" structural property of this node type. + * The "elseExpression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor ELSE_EXPRESSION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java index e8fa8b206..fa72fa888 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -34,14 +34,14 @@ import java.util.List; public class ConstructorInvocation extends Statement { /** - * The "typeArguments" structural property of this node type (added in JLS3 API). + * The "typeArguments" structural property of this node type (element type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(ConstructorInvocation.class, "typeArguments", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "arguments" structural property of this node type. + * The "arguments" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = @@ -96,7 +96,7 @@ public class ConstructorInvocation extends Statement { } /** - * The type arguments (element type: <code>Type</code>). + * The type arguments (element type: {@link Type}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -105,7 +105,7 @@ public class ConstructorInvocation extends Statement { /** * The list of argument expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList arguments = new ASTNode.NodeList(ARGUMENTS_PROPERTY); @@ -192,7 +192,7 @@ public class ConstructorInvocation extends Statement { * invocation (added in JLS3 API). * * @return the live list of type arguments - * (element type: <code>Type</code>) + * (element type: {@link Type}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -210,7 +210,7 @@ public class ConstructorInvocation extends Statement { * constructor invocation statement. * * @return the live list of argument expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List arguments() { return this.arguments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ContinueStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ContinueStatement.java index 605c91cf9..08a5bc309 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ContinueStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ContinueStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class ContinueStatement extends Statement { /** - * The "label" structural property of this node type. + * The "label" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor LABEL_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java index 27def9cb1..8b3800bec 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java @@ -1900,6 +1900,8 @@ class DefaultBindingResolver extends BindingResolver { typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_SHORT, 3)); } else if ("java.lang.Void".equals(name)) {//$NON-NLS-1$ typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_VOID, 3)); + } else if ("java.lang.AssertionError".equals(name)) { //$NON-NLS-1$ + typeBinding = this.getTypeBinding(this.scope.getType(TypeConstants.JAVA_LANG_ASSERTIONERROR, 3)); } } catch (AbortCompilation e) { // ignore missing types diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java index d51772cba..02c789df5 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java @@ -26,6 +26,12 @@ class DefaultValuePairBinding extends MemberValuePairBinding { super(null, resolver); this.method = binding; this.value = MemberValuePairBinding.buildDOMValue(binding.getDefaultValue(), resolver); + if (binding.returnType != null && binding.returnType.isArrayType()) { + if (!this.value.getClass().isArray()) { + // wrap into an array + this.value = new Object[] { this.value }; + } + } } public IMethodBinding getMethodBinding() { diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DoStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DoStatement.java index 3c12b9203..228d1aeaa 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DoStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DoStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,14 +28,14 @@ import java.util.List; public class DoStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(DoStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Statement}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnhancedForStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnhancedForStatement.java index 3625e8ab1..769ea339e 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnhancedForStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnhancedForStatement.java @@ -32,19 +32,19 @@ import java.util.List; public class EnhancedForStatement extends Statement { /** - * The "parameter" structural property of this node type. + * The "parameter" structural property of this node type (child type: {@link SingleVariableDeclaration}). */ public static final ChildPropertyDescriptor PARAMETER_PROPERTY = new ChildPropertyDescriptor(EnhancedForStatement.class, "parameter", SingleVariableDeclaration.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(EnhancedForStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Statement}). */ public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor(EnhancedForStatement.class, "body", Statement.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java index 9e633404a..f0b036dba 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -54,19 +54,19 @@ public class EnumConstantDeclaration extends BodyDeclaration { internalModifiers2PropertyFactory(EnumConstantDeclaration.class); /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(EnumConstantDeclaration.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "arguments" structural property of this node type. + * The "arguments" structural property of this node type (element type: {@link Expression}). */ public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(EnumConstantDeclaration.class, "arguments", Expression.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "anonymousClassDeclaration" structural property of this node type. + * The "anonymousClassDeclaration" structural property of this node type (child type: {@link AnonymousClassDeclaration}). */ public static final ChildPropertyDescriptor ANONYMOUS_CLASS_DECLARATION_PROPERTY = new ChildPropertyDescriptor(EnumConstantDeclaration.class, "anonymousClassDeclaration", AnonymousClassDeclaration.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$ @@ -111,7 +111,7 @@ public class EnumConstantDeclaration extends BodyDeclaration { /** * The list of argument expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList arguments = new ASTNode.NodeList(ARGUMENTS_PROPERTY); @@ -308,7 +308,7 @@ public class EnumConstantDeclaration extends BodyDeclaration { * to not explicitly specifying arguments. * * @return the live list of argument expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List arguments() { return this.arguments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java index 9515f5a0a..7eb1906ed 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -62,13 +62,13 @@ public class EnumDeclaration extends AbstractTypeDeclaration { internalNamePropertyFactory(EnumDeclaration.class); /** - * The "superInterfaceTypes" structural property of this node type. + * The "superInterfaceTypes" structural property of this node type (element type: {@link Type}). */ public static final ChildListPropertyDescriptor SUPER_INTERFACE_TYPES_PROPERTY = new ChildListPropertyDescriptor(EnumDeclaration.class, "superInterfaceTypes", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "enumConstants" structural property of this node type. + * The "enumConstants" structural property of this node type (element type: {@link EnumConstantDeclaration}). */ public static final ChildListPropertyDescriptor ENUM_CONSTANTS_PROPERTY = new ChildListPropertyDescriptor(EnumDeclaration.class, "enumConstants", EnumConstantDeclaration.class, CYCLE_RISK); //$NON-NLS-1$ @@ -113,7 +113,7 @@ public class EnumDeclaration extends AbstractTypeDeclaration { } /** - * The superinterface types (element type: <code>Type</code>). + * The superinterface types (element type: {@link Type}). * Defaults to an empty list. */ private ASTNode.NodeList superInterfaceTypes = @@ -121,7 +121,7 @@ public class EnumDeclaration extends AbstractTypeDeclaration { /** * The enum constant declarations - * (element type: <code>EnumConstantDeclaration</code>). + * (element type: {@link EnumConstantDeclaration}). * Defaults to an empty list. */ private ASTNode.NodeList enumConstants = @@ -288,7 +288,7 @@ public class EnumDeclaration extends AbstractTypeDeclaration { * declaration. * * @return the live list of super interface types - * (element type: <code>Type</code>) + * (element type: {@link Type}) */ public List superInterfaceTypes() { return this.superInterfaceTypes; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionStatement.java index d2313fe34..e098950b4 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -31,7 +31,7 @@ import java.util.List; public class ExpressionStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldAccess.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldAccess.java index e4ef8d71c..b6f7af706 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldAccess.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldAccess.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -58,14 +58,14 @@ import java.util.List; public class FieldAccess extends Expression { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(FieldAccess.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java index 628020b69..7a4c30417 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -60,14 +60,14 @@ public class FieldDeclaration extends BodyDeclaration { internalModifiers2PropertyFactory(FieldDeclaration.class); /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(FieldDeclaration.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "fragments" structural property of this node type). + * The "fragments" structural property of this node type (element type: {@link VariableDeclarationFragment}). * @since 3.0 */ public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = @@ -341,7 +341,7 @@ public class FieldDeclaration extends BodyDeclaration { * type of node will trigger an exception. * * @return the live list of variable declaration fragments in this - * statement (element type: <code>VariableDeclarationFragment</code>) + * statement (element type: {@link VariableDeclarationFragment}) */ public List fragments() { return this.variableDeclarationFragments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java index 1340426a9..38c373dea 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -44,28 +44,28 @@ import java.util.List; public class ForStatement extends Statement { /** - * The "initializers" structural property of this node type. + * The "initializers" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor INITIALIZERS_PROPERTY = new ChildListPropertyDescriptor(ForStatement.class, "initializers", Expression.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(ForStatement.class, "expression", Expression.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$ /** - * The "updaters" structural property of this node type. + * The "updaters" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor UPDATERS_PROPERTY = new ChildListPropertyDescriptor(ForStatement.class, "updaters", Expression.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Statement}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = @@ -105,7 +105,7 @@ public class ForStatement extends Statement { /** * The list of initializer expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList initializers = new ASTNode.NodeList(INITIALIZERS_PROPERTY); @@ -117,7 +117,7 @@ public class ForStatement extends Statement { /** * The list of update expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList updaters = new ASTNode.NodeList(UPDATERS_PROPERTY); @@ -241,7 +241,7 @@ public class ForStatement extends Statement { * </p> * * @return the live list of initializer expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List initializers() { return this.initializers; @@ -286,7 +286,7 @@ public class ForStatement extends Statement { * </p> * * @return the live list of update expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List updaters() { return this.updaters; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IfStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IfStatement.java index e5f8aa25e..44e426e99 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IfStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IfStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -27,21 +27,21 @@ import java.util.List; public class IfStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(IfStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "thenStatement" structural property of this node type. + * The "thenStatement" structural property of this node type (child type: {@link Statement}). * @since 3.0 */ public static final ChildPropertyDescriptor THEN_STATEMENT_PROPERTY = new ChildPropertyDescriptor(IfStatement.class, "thenStatement", Statement.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "elseStatement" structural property of this node type. + * The "elseStatement" structural property of this node type (child type: {@link Statement}). * @since 3.0 */ public static final ChildPropertyDescriptor ELSE_STATEMENT_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ImportDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ImportDeclaration.java index 5c2175aa1..b9618c844 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ImportDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ImportDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -34,21 +34,21 @@ import java.util.List; public class ImportDeclaration extends ASTNode { /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(ImportDeclaration.class, "name", Name.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "onDemand" structural property of this node type. + * The "onDemand" structural property of this node type (type: {@link Boolean}). * @since 3.0 */ public static final SimplePropertyDescriptor ON_DEMAND_PROPERTY = new SimplePropertyDescriptor(ImportDeclaration.class, "onDemand", boolean.class, MANDATORY); //$NON-NLS-1$ /** - * The "static" structural property of this node type (added in JLS3 API). + * The "static" structural property of this node type (type: {@link Boolean}) (added in JLS3 API). * @since 3.1 */ public static final SimplePropertyDescriptor STATIC_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java index 647d2d09b..f647e1093 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -174,28 +174,28 @@ public class InfixExpression extends Expression { } /** - * The "leftOperand" structural property of this node type. + * The "leftOperand" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor LEFT_OPERAND_PROPERTY = new ChildPropertyDescriptor(InfixExpression.class, "leftOperand", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "operator" structural property of this node type. + * The "operator" structural property of this node type (type: {@link InfixExpression.Operator}). * @since 3.0 */ public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor(InfixExpression.class, "operator", InfixExpression.Operator.class, MANDATORY); //$NON-NLS-1$ /** - * The "rightOperand" structural property of this node type. + * The "rightOperand" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor RIGHT_OPERAND_PROPERTY = new ChildPropertyDescriptor(InfixExpression.class, "rightOperand", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "extendedOperands" structural property of this node type. + * The "extendedOperands" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor EXTENDED_OPERANDS_PROPERTY = @@ -252,7 +252,7 @@ public class InfixExpression extends Expression { /** * The list of extended operand expressions (element type: - * <code>Expression</code>). Lazily initialized; defaults to an empty list. + * {@link Expression}). Lazily initialized; defaults to an empty list. */ private ASTNode.NodeList extendedOperands = null; @@ -507,7 +507,7 @@ public class InfixExpression extends Expression { * </p> * * @return the live list of extended operands - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List extendedOperands() { if (this.extendedOperands == null) { diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Initializer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Initializer.java index 405628003..80d3ea87b 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Initializer.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Initializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -48,7 +48,7 @@ public class Initializer extends BodyDeclaration { internalModifiers2PropertyFactory(Initializer.class); /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Block}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java index 0f083532b..3a334a733 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -27,14 +27,14 @@ import java.util.List; public class InstanceofExpression extends Expression { /** - * The "leftOperand" structural property of this node type. + * The "leftOperand" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor LEFT_OPERAND_PROPERTY = new ChildPropertyDescriptor(InstanceofExpression.class, "leftOperand", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "rightOperand" structural property of this node type. + * The "rightOperand" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor RIGHT_OPERAND_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java index b5eefc3dc..ccc4680a7 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -31,7 +31,7 @@ import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; public class Javadoc extends Comment { /** - * The "comment" structural property of this node type (JLS2 API only). + * The "comment" structural property of this node type (type: {@link String}) (JLS2 API only). * @since 3.0 * @deprecated Replaced by {@link #TAGS_PROPERTY} in the JLS3 API. */ @@ -39,7 +39,7 @@ public class Javadoc extends Comment { new SimplePropertyDescriptor(Javadoc.class, "comment", String.class, MANDATORY); //$NON-NLS-1$ /** - * The "tags" structural property of this node type. + * The "tags" structural property of this node type (element type: {@link TagElement}). * @since 3.1 */ public static final ChildListPropertyDescriptor TAGS_PROPERTY = @@ -109,7 +109,7 @@ public class Javadoc extends Comment { private String comment = MINIMAL_DOC_COMMENT; /** - * The list of tag elements (element type: <code>TagElement</code>). + * The list of tag elements (element type: {@link TagElement}). * Defaults to an empty list. * @since 3.0 */ @@ -292,7 +292,7 @@ public class Javadoc extends Comment { * </p> * * @return the live list of tag elements in this doc comment - * (element type: <code>TagElement</code>) + * (element type: {@link TagElement}) * @since 3.0 */ public List tags() { diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LabeledStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LabeledStatement.java index 632d1ea05..047899500 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LabeledStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LabeledStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,14 +28,14 @@ import java.util.List; public class LabeledStatement extends Statement { /** - * The "label" structural property of this node type. + * The "label" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor LABEL_PROPERTY = new ChildPropertyDescriptor(LabeledStatement.class, "label", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Statement}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberRef.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberRef.java index da408a15e..072a573f9 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberRef.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberRef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -31,14 +31,14 @@ import java.util.List; public class MemberRef extends ASTNode implements IDocElement { /** - * The "qualifier" structural property of this node type. + * The "qualifier" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor(MemberRef.class, "qualifier", Name.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePair.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePair.java index 6bf20e16d..b1a01e157 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePair.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePair.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -32,13 +32,13 @@ import java.util.List; public class MemberValuePair extends ASTNode { /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(MemberValuePair.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "value" structural property of this node type. + * The "value" structural property of this node type (child type: {@link Expression}). */ public static final ChildPropertyDescriptor VALUE_PROPERTY = new ChildPropertyDescriptor(MemberValuePair.class, "value", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java index 6f2c13bb3..6ced86c22 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java @@ -72,7 +72,8 @@ class MemberValuePairBinding implements IMemberValuePairBinding { return new Long(constant.longValue()); case TypeIds.T_short: return new Short(constant.shortValue()); - case TypeIds.T_JavaLangString: + default: + // TypeIds.T_JavaLangString: return constant.stringValue(); } } else if (internalObject instanceof org.eclipse.jdt.internal.compiler.lookup.TypeBinding) { @@ -139,6 +140,10 @@ class MemberValuePairBinding implements IMemberValuePairBinding { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; + IMethodBinding methodBinding = getMethodBinding(); + if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { + this.value = new Object[] { this.value }; + } } char[] internalName() { @@ -168,11 +173,11 @@ class MemberValuePairBinding implements IMemberValuePairBinding { return true; if (binding.getKind() != IBinding.MEMBER_VALUE_PAIR) return false; - IMemberValuePairBinding other = (IMemberValuePairBinding) binding; - if (!getMethodBinding().isEqualTo(other.getMethodBinding())) { + IMemberValuePairBinding otherMemberValuePairBinding = (IMemberValuePairBinding) binding; + if (!getMethodBinding().isEqualTo(otherMemberValuePairBinding.getMethodBinding())) { return false; } - Object otherValue = other.getValue(); + Object otherValue = otherMemberValuePairBinding.getValue(); Object currentValue = getValue(); if (currentValue == null) { return otherValue == null; @@ -183,7 +188,34 @@ class MemberValuePairBinding implements IMemberValuePairBinding { } return false; } - return currentValue.equals(otherValue); + if (currentValue.getClass().isArray()) { + if (!otherValue.getClass().isArray()) { + return false; + } + Object[] currentValues = (Object[]) currentValue; + Object[] otherValues = (Object[]) otherValue; + final int length = currentValues.length; + if (length != otherValues.length) { + return false; + } + for (int i = 0; i < length; i++) { + Object current = currentValues[i]; + Object other = otherValues[i]; + if (current instanceof IBinding) { + if (!(other instanceof IBinding)) { + return false; + } + if (!((IBinding) current).isEqualTo((IBinding) other)) { + return false; + } + } else if (!current.equals(other)) { + return false; + } + } + return true; + } else { + return currentValue.equals(otherValue); + } } /* diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java index 93259be1c..d66f5e9a2 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java @@ -69,7 +69,7 @@ import java.util.List; public class MethodDeclaration extends BodyDeclaration { /** - * The "javadoc" structural property of this node type. + * The "javadoc" structural property of this node type (child type: {@link Javadoc}). * @since 3.0 */ public static final ChildPropertyDescriptor JAVADOC_PROPERTY = @@ -90,56 +90,56 @@ public class MethodDeclaration extends BodyDeclaration { internalModifiers2PropertyFactory(MethodDeclaration.class); /** - * The "constructor" structural property of this node type. + * The "constructor" structural property of this node type (type: {@link Boolean}). * @since 3.0 */ public static final SimplePropertyDescriptor CONSTRUCTOR_PROPERTY = new SimplePropertyDescriptor(MethodDeclaration.class, "constructor", boolean.class, MANDATORY); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(MethodDeclaration.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "returnType" structural property of this node type (JLS2 API only). + * The "returnType" structural property of this node type (child type: {@link Type}) (JLS2 API only). * @since 3.0 */ public static final ChildPropertyDescriptor RETURN_TYPE_PROPERTY = new ChildPropertyDescriptor(MethodDeclaration.class, "returnType", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "returnType2" structural property of this node type (added in JLS3 API). + * The "returnType2" structural property of this node type (child type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildPropertyDescriptor RETURN_TYPE2_PROPERTY = new ChildPropertyDescriptor(MethodDeclaration.class, "returnType2", Type.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "extraDimensions" structural property of this node type. + * The "extraDimensions" structural property of this node type (type: {@link Integer}). * @since 3.0 */ public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor(MethodDeclaration.class, "extraDimensions", int.class, MANDATORY); //$NON-NLS-1$ /** - * The "typeParameters" structural property of this node type (added in JLS3 API). + * The "typeParameters" structural property of this node type (element type: {@link TypeParameter}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor TYPE_PARAMETERS_PROPERTY = new ChildListPropertyDescriptor(MethodDeclaration.class, "typeParameters", TypeParameter.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "parameters" structural property of this node type). + * The "parameters" structural property of this node type (element type: {@link SingleVariableDeclaration}). * @since 3.0 */ public static final ChildListPropertyDescriptor PARAMETERS_PROPERTY = new ChildListPropertyDescriptor(MethodDeclaration.class, "parameters", SingleVariableDeclaration.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "thrownExceptions" structural property of this node type). + * The "thrownExceptions" structural property of this node type (element type: {@link Name}). * @since 3.0 */ public static final ChildListPropertyDescriptor THROWN_EXCEPTIONS_PROPERTY = @@ -155,7 +155,7 @@ public class MethodDeclaration extends BodyDeclaration { // SH} /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Block}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = @@ -243,7 +243,7 @@ public class MethodDeclaration extends BodyDeclaration { /** * The parameter declarations - * (element type: <code>SingleVariableDeclaration</code>). + * (element type: {@link SingleVariableDeclaration}). * Defaults to an empty list. */ private ASTNode.NodeList parameters = @@ -264,7 +264,7 @@ public class MethodDeclaration extends BodyDeclaration { private boolean returnType2Initialized = false; /** - * The type paramters (element type: <code>TypeParameter</code>). + * The type paramters (element type: {@link TypeParameter}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -280,7 +280,7 @@ public class MethodDeclaration extends BodyDeclaration { private int extraArrayDimensions = 0; /** - * The list of thrown exception names (element type: <code>Name</code>). + * The list of thrown exception names (element type: {@link Name}). * Defaults to an empty list. */ private ASTNode.NodeList thrownExceptions = @@ -568,7 +568,7 @@ public class MethodDeclaration extends BodyDeclaration { * declaration (added in JLS3 API). This list is non-empty for parameterized methods. * * @return the live list of type parameters - * (element type: <code>TypeParameter</code>) + * (element type: {@link TypeParameter}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -629,7 +629,7 @@ public class MethodDeclaration extends BodyDeclaration { * method declaration. * * @return the live list of method parameter declarations - * (element type: <code>SingleVariableDeclaration</code>) + * (element type: {@link SingleVariableDeclaration}) */ public List parameters() { return this.parameters; @@ -665,7 +665,7 @@ public class MethodDeclaration extends BodyDeclaration { * declaration. * * @return the live list of exception names - * (element type: <code>Name</code>) + * (element type: {@link Name}) */ public List thrownExceptions() { return this.thrownExceptions; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java index c8e827325..b91289bbe 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -35,28 +35,28 @@ import java.util.List; public class MethodInvocation extends Expression { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(MethodInvocation.class, "expression", Expression.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$ /** - * The "typeArguments" structural property of this node type (added in JLS3 API). + * The "typeArguments" structural property of this node type (element type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(MethodInvocation.class, "typeArguments", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(MethodInvocation.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "arguments" structural property of this node type. + * The "arguments" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = @@ -120,7 +120,7 @@ public class MethodInvocation extends Expression { private Expression optionalExpression = null; /** - * The type arguments (element type: <code>Type</code>). + * The type arguments (element type: {@link Type}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -135,7 +135,7 @@ public class MethodInvocation extends Expression { /** * The list of argument expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList arguments = new ASTNode.NodeList(ARGUMENTS_PROPERTY); @@ -296,7 +296,7 @@ public class MethodInvocation extends Expression { * invocation (added in JLS3 API). * * @return the live list of type arguments - * (element type: <code>Type</code>) + * (element type: {@link Type}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -354,7 +354,7 @@ public class MethodInvocation extends Expression { * invocation expression. * * @return the live list of argument expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List arguments() { return this.arguments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java index 503e24c9c..56f70fee6 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -31,21 +31,21 @@ import java.util.List; public class MethodRef extends ASTNode implements IDocElement { /** - * The "qualifier" structural property of this node type. + * The "qualifier" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor(MethodRef.class, "qualifier", Name.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(MethodRef.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "parameters" structural property of this node type. + * The "parameters" structural property of this node type (element type: {@link MethodRefParameter}). * @since 3.0 */ public static final ChildListPropertyDescriptor PARAMETERS_PROPERTY = @@ -93,7 +93,7 @@ public class MethodRef extends ASTNode implements IDocElement { /** * The parameter declarations - * (element type: <code>MethodRefParameter</code>). + * (element type: {@link MethodRefParameter}). * Defaults to an empty list. */ private ASTNode.NodeList parameters = @@ -275,7 +275,7 @@ public class MethodRef extends ASTNode implements IDocElement { * method reference. * * @return the live list of method parameter references - * (element type: <code>MethodRefParameter</code>) + * (element type: {@link MethodRefParameter}) */ public List parameters() { return this.parameters; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRefParameter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRefParameter.java index 1cfc779a5..fd213c42c 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRefParameter.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRefParameter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -42,21 +42,21 @@ import java.util.List; public class MethodRefParameter extends ASTNode { /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(MethodRefParameter.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "varargs" structural property of this node type (added in JLS3 API). + * The "varargs" structural property of this node type (type: {@link Boolean}) (added in JLS3 API). * @since 3.1 */ public static final SimplePropertyDescriptor VARARGS_PROPERTY = new SimplePropertyDescriptor(MethodRefParameter.class, "varargs", boolean.class, MANDATORY); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java index 6c0e607c0..faeffbe92 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -252,7 +252,7 @@ public final class Modifier extends ASTNode implements IExtendedModifier { public static final int FINAL = 0x0010; /** - * The "keyword" structural property of this node type. + * The "keyword" structural property of this node type (type: {@link Modifier.ModifierKeyword}). * @since 3.0 */ public static final SimplePropertyDescriptor KEYWORD_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnviromentWithProgress.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnviromentWithProgress.java index b6404252d..5dfbfbf1a 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnviromentWithProgress.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnviromentWithProgress.java @@ -15,14 +15,14 @@ import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jdt.internal.compiler.batch.FileSystem; import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; -import org.eclipse.jdt.internal.core.INameEnviromentWithProgress; +import org.eclipse.jdt.internal.core.INameEnvironmentWithProgress; import org.eclipse.jdt.internal.core.NameLookup; /** * Batch name environment that is cancelable using a monitor. * @since 3.6 */ -class NameEnviromentWithProgress extends FileSystem implements INameEnviromentWithProgress { +class NameEnviromentWithProgress extends FileSystem implements INameEnvironmentWithProgress { IProgressMonitor monitor; public NameEnviromentWithProgress(Classpath[] paths, String[] initialFileNames, IProgressMonitor monitor) { diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java index 36a7095a8..f5bc4e899 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java @@ -24,7 +24,7 @@ import org.eclipse.jdt.internal.core.NameLookup; */ class NameEnvironmentWithProgress extends FileSystem implements INameEnvironmentWithProgress { IProgressMonitor monitor; - + public NameEnvironmentWithProgress(Classpath[] paths, String[] initialFileNames, IProgressMonitor monitor) { super(paths, initialFileNames); setMonitor(monitor); @@ -49,7 +49,7 @@ class NameEnvironmentWithProgress extends FileSystem implements INameEnvironment checkCanceled(); return super.isPackage(compoundName, packageName); } - + public void setMonitor(IProgressMonitor monitor) { this.monitor = monitor; } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java index 87034ae98..16c6762e0 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -34,7 +34,7 @@ public final class NormalAnnotation extends Annotation { internalTypeNamePropertyFactory(NormalAnnotation.class); /** - * The "values" structural property of this node type. + * The "values" structural property of this node type (element type: {@link MemberValuePair}). */ public static final ChildListPropertyDescriptor VALUES_PROPERTY = new ChildListPropertyDescriptor(NormalAnnotation.class, "values", MemberValuePair.class, CYCLE_RISK); //$NON-NLS-1$ @@ -177,7 +177,7 @@ public final class NormalAnnotation extends Annotation { * type of node will trigger an exception. * * @return the live list of member value pairs in this - * annotation (element type: <code>MemberValuePair</code>) + * annotation (element type: {@link MemberValuePair}) */ public List values() { return this.values; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NumberLiteral.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NumberLiteral.java index 79e14a96d..a1eb08be7 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NumberLiteral.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NumberLiteral.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -27,7 +27,7 @@ import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; public class NumberLiteral extends Expression { /** - * The "token" structural property of this node type. + * The "token" structural property of this node type (type: {@link String}). * @since 3.0 */ public static final SimplePropertyDescriptor TOKEN_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageDeclaration.java index 719958f89..03e1ba4e2 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -38,21 +38,21 @@ import java.util.List; public class PackageDeclaration extends ASTNode { /** - * The "javadoc" structural property of this node type. + * The "javadoc" structural property of this node type (child type: {@link Javadoc}). * @since 3.0 */ public static final ChildPropertyDescriptor JAVADOC_PROPERTY = new ChildPropertyDescriptor(PackageDeclaration.class, "javadoc", Javadoc.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "annotations" structural property of this node type (added in JLS3 API). + * The "annotations" structural property of this node type (element type: {@link Annotation}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY = new ChildListPropertyDescriptor(PackageDeclaration.class, "annotations", Annotation.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = @@ -115,7 +115,7 @@ public class PackageDeclaration extends ASTNode { Javadoc optionalDocComment = null; /** - * The annotations (element type: <code>Annotation</code>). + * The annotations (element type: {@link Annotation}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -238,7 +238,7 @@ public class PackageDeclaration extends ASTNode { * package declaration (added in JLS3 API). * * @return the live list of annotations - * (element type: <code>Annotation</code>) + * (element type: {@link Annotation}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java index d0ea6ba22..65d524dc6 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2010 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 @@ -36,13 +36,13 @@ public class ParameterizedType extends Type { int index; /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(ParameterizedType.class, "type", Type.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "typeArguments" structural property of this node type. + * The "typeArguments" structural property of this node type (element type: {@link Type}). */ public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(ParameterizedType.class, "typeArguments", Type.class, CYCLE_RISK); //$NON-NLS-1$ @@ -83,7 +83,7 @@ public class ParameterizedType extends Type { private Type type = null; /** - * The type arguments (element type: <code>Type</code>). + * The type arguments (element type: {@link Type}). * Defaults to an empty list. */ private ASTNode.NodeList typeArguments = @@ -223,7 +223,7 @@ public class ParameterizedType extends Type { * at least one element and not contain primitive types. * * @return the live list of type arguments - * (element type: <code>Type</code>) + * (element type: {@link Type}) */ public List typeArguments() { return this.typeArguments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParenthesizedExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParenthesizedExpression.java index f16a0508c..ba97b477f 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParenthesizedExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParenthesizedExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class ParenthesizedExpression extends Expression { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java index 1b4950a5f..da88378c7 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -105,14 +105,14 @@ public class PostfixExpression extends Expression { } /** - * The "operator" structural property of this node type. + * The "operator" structural property of this node type (type: {@link PostfixExpression.Operator}). * @since 3.0 */ public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor(PostfixExpression.class, "operator", PostfixExpression.Operator.class, MANDATORY); //$NON-NLS-1$ /** - * The "operand" structural property of this node type. + * The "operand" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor OPERAND_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java index 97ab05d80..307109d35 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -121,14 +121,14 @@ public class PrefixExpression extends Expression { } /** - * The "operator" structural property of this node type. + * The "operator" structural property of this node type (type: {@link PrefixExpression.Operator}). * @since 3.0 */ public static final SimplePropertyDescriptor OPERATOR_PROPERTY = new SimplePropertyDescriptor(PrefixExpression.class, "operator", PrefixExpression.Operator.class, MANDATORY); //$NON-NLS-1$ /** - * The "operand" structural property of this node type. + * The "operand" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor OPERAND_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java index 7c98424bf..9ab7c3d09 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -155,7 +155,7 @@ public class PrimitiveType extends Type { } /** - * The "primitiveTypeCode" structural property of this node type. + * The "primitiveTypeCode" structural property of this node type (type: {@link PrimitiveType.Code}). * @since 3.0 */ public static final SimplePropertyDescriptor PRIMITIVE_TYPE_CODE_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedName.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedName.java index fe2b6cd81..c7753b2ed 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedName.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedName.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -35,14 +35,14 @@ import java.util.List; public class QualifiedName extends Name { /** - * The "qualifier" structural property of this node type. + * The "qualifier" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor(QualifiedName.class, "qualifier", Name.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java index 136881578..6ee9866ff 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2010 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 @@ -51,13 +51,13 @@ public class QualifiedType extends Type { int index; /** - * The "qualifier" structural property of this node type. + * The "qualifier" structural property of this node type (child type: {@link Type}). */ public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor(QualifiedType.class, "qualifier", Type.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(QualifiedType.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ReturnStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ReturnStatement.java index ec26455fc..046e81b96 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ReturnStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ReturnStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class ReturnStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java index a52f69c2a..019ffc913 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -35,7 +35,7 @@ import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; public class SimpleName extends Name { /** - * The "identifier" structural property of this node type. + * The "identifier" structural property of this node type (type: {@link String}). * * @since 3.0 */ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java index 6dc099ab9..9e256c647 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -27,7 +27,7 @@ import java.util.List; public class SimpleType extends Type { /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleMemberAnnotation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleMemberAnnotation.java index edb2b4b8e..08b2c28e6 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleMemberAnnotation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleMemberAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -37,7 +37,7 @@ public final class SingleMemberAnnotation extends Annotation { internalTypeNamePropertyFactory(SingleMemberAnnotation.class); /** - * The "value" structural property of this node type. + * The "value" structural property of this node type (child type: {@link Expression}). */ public static final ChildPropertyDescriptor VALUE_PROPERTY = new ChildPropertyDescriptor(SingleMemberAnnotation.class, "value", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java index c2b7519cb..1a7a888b4 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -39,49 +39,49 @@ import java.util.List; public class SingleVariableDeclaration extends VariableDeclaration { /** - * The "modifiers" structural property of this node type (JLS2 API only). + * The "modifiers" structural property of this node type (type: {@link Integer}) (JLS2 API only). * @since 3.0 */ public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor(SingleVariableDeclaration.class, "modifiers", int.class, MANDATORY); //$NON-NLS-1$ /** - * The "modifiers" structural property of this node type (added in JLS3 API). + * The "modifiers" structural property of this node type (element type: {@link IExtendedModifier}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor(SingleVariableDeclaration.class, "modifiers", IExtendedModifier.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(SingleVariableDeclaration.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(SingleVariableDeclaration.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "varargs" structural property of this node type (added in JLS3 API). + * The "varargs" structural property of this node type (type: {@link Boolean}) (added in JLS3 API). * @since 3.1 */ public static final SimplePropertyDescriptor VARARGS_PROPERTY = new SimplePropertyDescriptor(SingleVariableDeclaration.class, "varargs", boolean.class, MANDATORY); //$NON-NLS-1$ /** - * The "extraDimensions" structural property of this node type. + * The "extraDimensions" structural property of this node type (type: {@link Integer}). * @since 3.0 */ public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor(SingleVariableDeclaration.class, "extraDimensions", int.class, MANDATORY); //$NON-NLS-1$ /** - * The "initializer" structural property of this node type. + * The "initializer" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = @@ -143,7 +143,7 @@ public class SingleVariableDeclaration extends VariableDeclaration { } /** - * The extended modifiers (element type: <code>IExtendedModifier</code>). + * The extended modifiers (element type: {@link IExtendedModifier}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @@ -384,7 +384,7 @@ public class SingleVariableDeclaration extends VariableDeclaration { * </p> * * @return the live list of modifiers and annotations - * (element type: <code>IExtendedModifier</code>) + * (element type: {@link IExtendedModifier}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringLiteral.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringLiteral.java index f2e34c0ac..c5b7b89a2 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringLiteral.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringLiteral.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -27,7 +27,7 @@ import org.eclipse.jdt.internal.compiler.parser.TerminalTokens; public class StringLiteral extends Expression { /** - * The "escapedValue" structural property of this node type. + * The "escapedValue" structural property of this node type (type: {@link String}). * @since 3.0 */ public static final SimplePropertyDescriptor ESCAPED_VALUE_PROPERTY = @@ -291,9 +291,6 @@ public class StringLiteral extends Expression { case '\"': b.append("\\\""); //$NON-NLS-1$ break; - case '\'': - b.append("\\\'"); //$NON-NLS-1$ - break; case '\\': b.append("\\\\"); //$NON-NLS-1$ break; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java index 8da893813..b43bf1efa 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -35,14 +35,14 @@ import java.util.List; public class SuperConstructorInvocation extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(SuperConstructorInvocation.class, "expression", Expression.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$ /** - * The "typeArguments" structural property of this node type (added in JLS3 API). + * The "typeArguments" structural property of this node type (element type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = @@ -111,7 +111,7 @@ public class SuperConstructorInvocation extends Statement { private Expression optionalExpression = null; /** - * The type arguments (element type: <code>Type</code>). + * The type arguments (element type: {@link Type}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -120,7 +120,7 @@ public class SuperConstructorInvocation extends Statement { /** * The list of argument expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList arguments = new ASTNode.NodeList(ARGUMENTS_PROPERTY); @@ -258,7 +258,7 @@ public class SuperConstructorInvocation extends Statement { * invocation (added in JLS3 API). * * @return the live list of type arguments - * (element type: <code>Type</code>) + * (element type: {@link Type}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -276,7 +276,7 @@ public class SuperConstructorInvocation extends Statement { * constructor invocation statement. * * @return the live list of argument expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List arguments() { return this.arguments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperFieldAccess.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperFieldAccess.java index 317270357..12ebbf1ac 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperFieldAccess.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperFieldAccess.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -34,14 +34,14 @@ import java.util.List; public class SuperFieldAccess extends Expression { /** - * The "qualifier" structural property of this node type. + * The "qualifier" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor(SuperFieldAccess.class, "qualifier", Name.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java index bd61dbfb9..53af4f2b4 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -36,28 +36,28 @@ import java.util.List; public class SuperMethodInvocation extends Expression { /** - * The "qualifier" structural property of this node type. + * The "qualifier" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = new ChildPropertyDescriptor(SuperMethodInvocation.class, "qualifier", Name.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "typeArguments" structural property of this node type (added in JLS3 API). + * The "typeArguments" structural property of this node type (element type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor TYPE_ARGUMENTS_PROPERTY = new ChildListPropertyDescriptor(SuperMethodInvocation.class, "typeArguments", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(SuperMethodInvocation.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "arguments" structural property of this node type. + * The "arguments" structural property of this node type (element type: {@link Expression}). * @since 3.0 */ public static final ChildListPropertyDescriptor ARGUMENTS_PROPERTY = @@ -121,7 +121,7 @@ public class SuperMethodInvocation extends Expression { private Name optionalQualifier = null; /** - * The type arguments (element type: <code>Type</code>). + * The type arguments (element type: {@link Type}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -136,7 +136,7 @@ public class SuperMethodInvocation extends Expression { /** * The list of argument expressions (element type: - * <code>Expression</code>). Defaults to an empty list. + * {@link Expression}). Defaults to an empty list. */ private ASTNode.NodeList arguments = new ASTNode.NodeList(ARGUMENTS_PROPERTY); @@ -294,7 +294,7 @@ public class SuperMethodInvocation extends Expression { * invocation (added in JLS3 API). * * @return the live list of type arguments - * (element type: <code>Type</code>) + * (element type: {@link Type}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -352,7 +352,7 @@ public class SuperMethodInvocation extends Expression { * "super" method invocation expression. * * @return the live list of argument expressions - * (element type: <code>Expression</code>) + * (element type: {@link Expression}) */ public List arguments() { return this.arguments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java index db72dbb28..87953a604 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -31,7 +31,7 @@ import java.util.List; public class SwitchCase extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java index e597dc7d5..cd19e2ac5 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -35,14 +35,14 @@ import java.util.List; public class SwitchStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(SwitchStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "statements" structural property of this node type. + * The "statements" structural property of this node type (element type: {@link Statement}). * @since 3.0 */ public static final ChildListPropertyDescriptor STATEMENTS_PROPERTY = @@ -85,7 +85,7 @@ public class SwitchStatement extends Statement { /** * The statements and SwitchCase nodes - * (element type: <code>Statement</code>). + * (element type: {@link Statement}). * Defaults to an empty list. */ private ASTNode.NodeList statements = @@ -225,7 +225,7 @@ public class SwitchStatement extends Statement { * the switch groups. * * @return the live list of statement nodes - * (element type: <code>Statement</code>) + * (element type: {@link Statement}) */ public List statements() { return this.statements; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SynchronizedStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SynchronizedStatement.java index 8e0acdc6e..dbc27f42b 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SynchronizedStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SynchronizedStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,14 +28,14 @@ import java.util.List; public class SynchronizedStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(SynchronizedStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Block}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java index 8c148b9e4..cb1ed6607 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -36,7 +36,7 @@ import java.util.List; public final class TagElement extends ASTNode implements IDocElement { /** - * The "tagName" structural property of this node type. + * The "tagName" structural property of this node type (type: {@link String}). * * @since 3.0 */ @@ -44,7 +44,7 @@ public final class TagElement extends ASTNode implements IDocElement { new SimplePropertyDescriptor(TagElement.class, "tagName", String.class, OPTIONAL); //$NON-NLS-1$ /** - * The "fragments" structural property of this node type. + * The "fragments" structural property of this node type (element type: {@link IDocElement}). * @since 3.0 */ public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = @@ -189,7 +189,7 @@ public final class TagElement extends ASTNode implements IDocElement { private String optionalTagName = null; /** - * The list of doc elements (element type: <code>IDocElement</code>). + * The list of doc elements (element type: {@link IDocElement}). * Defaults to an empty list. */ private ASTNode.NodeList fragments = @@ -356,7 +356,7 @@ public final class TagElement extends ASTNode implements IDocElement { * of node will trigger an exception. * * @return the live list of doc elements in this tag element - * (element type: <code>ASTNode</code>) + * (element type: {@link ASTNode}) */ public List fragments() { return this.fragments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextElement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextElement.java index 3e21f29d3..774c861d3 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextElement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2008 IBM Corporation and others. + * Copyright (c) 2004, 2010 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 @@ -30,7 +30,7 @@ import org.eclipse.jdt.internal.compiler.util.Util; public final class TextElement extends ASTNode implements IDocElement { /** - * The "text" structural property of this node type. + * The "text" structural property of this node type (type: {@link String}). * * @since 3.0 */ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThisExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThisExpression.java index 766c223d5..88ce5e863 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThisExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThisExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -33,7 +33,7 @@ import java.util.List; public class ThisExpression extends Expression { /** - * The "qualifier" structural property of this node type. + * The "qualifier" structural property of this node type (child type: {@link Name}). * @since 3.0 */ public static final ChildPropertyDescriptor QUALIFIER_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThrowStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThrowStatement.java index e4f1da871..2f9b77bc2 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThrowStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThrowStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class ThrowStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java index bb87b8c94..edb118d2a 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -30,21 +30,21 @@ import java.util.List; public class TryStatement extends Statement { /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Block}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = new ChildPropertyDescriptor(TryStatement.class, "body", Block.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "catchClauses" structural property of this node type. + * The "catchClauses" structural property of this node type (element type: {@link CatchClause}). * @since 3.0 */ public static final ChildListPropertyDescriptor CATCH_CLAUSES_PROPERTY = new ChildListPropertyDescriptor(TryStatement.class, "catchClauses", CatchClause.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "finally" structural property of this node type. + * The "finally" structural property of this node type (child type: {@link Block}). * @since 3.0 */ public static final ChildPropertyDescriptor FINALLY_PROPERTY = @@ -86,7 +86,7 @@ public class TryStatement extends Statement { private Block body = null; /** - * The catch clauses (element type: <code>CatchClause</code>). + * The catch clauses (element type: {@link CatchClause}). * Defaults to an empty list. */ private ASTNode.NodeList catchClauses = @@ -243,7 +243,7 @@ public class TryStatement extends Statement { * Returns the live ordered list of catch clauses for this try statement. * * @return the live list of catch clauses - * (element type: <code>CatchClause</code>) + * (element type: {@link CatchClause}) */ public List catchClauses() { return this.catchClauses; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java index bf44a8653..3e129ec91 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -93,7 +93,7 @@ public class TypeDeclaration extends AbstractTypeDeclaration { internalModifiers2PropertyFactory(TypeDeclaration.class); /** - * The "interface" structural property of this node type. + * The "interface" structural property of this node type (type: {@link Boolean}). * @since 3.0 */ public static final SimplePropertyDescriptor INTERFACE_PROPERTY = @@ -134,35 +134,35 @@ public class TypeDeclaration extends AbstractTypeDeclaration { internalNamePropertyFactory(TypeDeclaration.class); /** - * The "superclass" structural property of this node type (JLS2 API only). + * The "superclass" structural property of this node type (child type: {@link Name}) (JLS2 API only). * @since 3.0 */ public static final ChildPropertyDescriptor SUPERCLASS_PROPERTY = new ChildPropertyDescriptor(TypeDeclaration.class, "superclass", Name.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "superInterfaces" structural property of this node type (JLS2 API only). + * The "superInterfaces" structural property of this node type (element type: {@link Name}) (JLS2 API only). * @since 3.0 */ public static final ChildListPropertyDescriptor SUPER_INTERFACES_PROPERTY = new ChildListPropertyDescriptor(TypeDeclaration.class, "superInterfaces", Name.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "superclassType" structural property of this node type (added in JLS3 API). + * The "superclassType" structural property of this node type (child type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildPropertyDescriptor SUPERCLASS_TYPE_PROPERTY = new ChildPropertyDescriptor(TypeDeclaration.class, "superclassType", Type.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "superInterfaceTypes" structural property of this node type (added in JLS3 API). + * The "superInterfaceTypes" structural property of this node type (element type: {@link Type}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor SUPER_INTERFACE_TYPES_PROPERTY = new ChildListPropertyDescriptor(TypeDeclaration.class, "superInterfaceTypes", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "typeParameters" structural property of this node type (added in JLS3 API). + * The "typeParameters" structural property of this node type (element type: {@link TypeParameter}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor TYPE_PARAMETERS_PROPERTY = @@ -277,7 +277,7 @@ public class TypeDeclaration extends AbstractTypeDeclaration { //gbr} /** - * The type paramters (element type: <code>TypeParameter</code>). + * The type paramters (element type: {@link TypeParameter}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -300,7 +300,7 @@ public class TypeDeclaration extends AbstractTypeDeclaration { Name optionalSuperclassName = null; // SH} /** - * The superinterface names (element type: <code>Name</code>). + * The superinterface names (element type: {@link Name}). * JLS2 only; defaults to an empty list. Not used in JLS3. * (see constructor). * @@ -324,7 +324,7 @@ public class TypeDeclaration extends AbstractTypeDeclaration { Type optionalSuperclassType = null; // SH} /** - * The superinterface types (element type: <code>Type</code>). + * The superinterface types (element type: {@link Type}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -751,7 +751,7 @@ public class TypeDeclaration extends AbstractTypeDeclaration { * declaration (added in JLS3 API). This list is non-empty for parameterized types. * * @return the live list of type parameters - * (element type: <code>TypeParameter</code>) + * (element type: {@link TypeParameter}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -889,7 +889,7 @@ public class TypeDeclaration extends AbstractTypeDeclaration { * extends. * * @return the live list of interface names - * (element type: <code>Name</code>) + * (element type: {@link Name}) * @exception UnsupportedOperationException if this operation is used in * an AST later than JLS2 * @deprecated In the JLS3 API, this method is replaced by @@ -919,7 +919,7 @@ public class TypeDeclaration extends AbstractTypeDeclaration { * these are the interfaces that this interface extends. * * @return the live list of interface types - * (element type: <code>Type</code>) + * (element type: {@link Type}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclarationStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclarationStatement.java index b8d2c4fd9..515042b2e 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclarationStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclarationStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -41,14 +41,14 @@ import java.util.List; public class TypeDeclarationStatement extends Statement { /** - * The "typeDeclaration" structural property of this node type (JLS2 API only). + * The "typeDeclaration" structural property of this node type (child type: {@link TypeDeclaration}) (JLS2 API only). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_DECLARATION_PROPERTY = new ChildPropertyDescriptor(TypeDeclarationStatement.class, "typeDeclaration", TypeDeclaration.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "declaration" structural property of this node type (added in JLS3 API). + * The "declaration" structural property of this node type (child type: {@link AbstractTypeDeclaration}) (added in JLS3 API). * @since 3.1 */ public static final ChildPropertyDescriptor DECLARATION_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeLiteral.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeLiteral.java index bed1fa173..d37e264a7 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeLiteral.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeLiteral.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,7 +28,7 @@ import java.util.List; public class TypeLiteral extends Expression { /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java index e5ee09d80..9246581bc 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2010 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 @@ -28,13 +28,13 @@ import java.util.List; public class TypeParameter extends ASTNode { /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(TypeParameter.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "typeBounds" structural property of this node type. + * The "typeBounds" structural property of this node type (element type: {@link Type}). */ public static final ChildListPropertyDescriptor TYPE_BOUNDS_PROPERTY = new ChildListPropertyDescriptor(TypeParameter.class, "typeBounds", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$ @@ -90,7 +90,7 @@ public class TypeParameter extends ASTNode { private SimpleName typeVariableName = null; /** - * The type bounds (element type: <code>Type</code>). + * The type bounds (element type: {@link Type}). * Defaults to an empty list. */ private ASTNode.NodeList typeBounds = @@ -264,7 +264,7 @@ public class TypeParameter extends ASTNode { * and parameterized types are allowed). * * @return the live list of type bounds - * (element type: <code>Type</code>) + * (element type: {@link Type}) */ public List typeBounds() { return this.typeBounds; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java index afc79fae1..7703fb61a 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java @@ -264,25 +264,45 @@ class VariableBinding implements IVariableBinding { int nameLength; int sourceStart; int sourceLength; + int modifiers = 0; if (localVar instanceof SingleVariableDeclaration) { sourceStart = localVar.getStartPosition(); sourceLength = localVar.getLength(); - SimpleName simpleName = ((SingleVariableDeclaration) localVar).getName(); + final SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) localVar; + SimpleName simpleName = singleVariableDeclaration.getName(); nameStart = simpleName.getStartPosition(); nameLength = simpleName.getLength(); + modifiers = singleVariableDeclaration.getModifiers(); } else { nameStart = localVar.getStartPosition(); nameLength = localVar.getLength(); ASTNode node = localVar.getParent(); sourceStart = node.getStartPosition(); sourceLength = node.getLength(); + VariableDeclarationFragment fragment = (VariableDeclarationFragment) localVar; + final ASTNode parent = fragment.getParent(); + switch (parent.getNodeType()) { + case ASTNode.VARIABLE_DECLARATION_EXPRESSION : + VariableDeclarationExpression expression = (VariableDeclarationExpression) parent; + modifiers = expression.getModifiers(); + break; + case ASTNode.VARIABLE_DECLARATION_STATEMENT : + VariableDeclarationStatement statement = (VariableDeclarationStatement) parent; + modifiers = statement.getModifiers(); + break; + case ASTNode.FIELD_DECLARATION : + FieldDeclaration fieldDeclaration = (FieldDeclaration) parent; + modifiers = fieldDeclaration.getModifiers(); + break; + } } int sourceEnd = sourceStart+sourceLength-1; char[] typeSig = this.binding.type.genericTypeSignature(); JavaElement parent = null; IMethodBinding declaringMethod = getDeclaringMethod(); + final LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding; if (declaringMethod == null) { - ReferenceContext referenceContext = ((LocalVariableBinding) this.binding).declaringScope.referenceContext(); + ReferenceContext referenceContext = localVariableBinding.declaringScope.referenceContext(); if (referenceContext instanceof TypeDeclaration){ // Local variable is declared inside an initializer TypeDeclaration typeDeclaration = (TypeDeclaration) referenceContext; @@ -299,7 +319,17 @@ class VariableBinding implements IVariableBinding { parent = (JavaElement) declaringMethod.getJavaElement(); } if (parent == null) return null; - return new LocalVariable(parent, localVar.getName().getIdentifier(), sourceStart, sourceEnd, nameStart, nameStart+nameLength-1, new String(typeSig), ((LocalVariableBinding) this.binding).declaration.annotations); + return new LocalVariable( + parent, + localVar.getName().getIdentifier(), + sourceStart, + sourceEnd, + nameStart, + nameStart+nameLength-1, + new String(typeSig), + localVariableBinding.declaration.annotations, + modifiers, + (localVariableBinding.tagBits & TagBits.IsArgument) != 0); } /* diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java index 36e515879..7c13d499e 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -45,28 +45,28 @@ import java.util.List; public class VariableDeclarationExpression extends Expression { /** - * The "modifiers" structural property of this node type (JLS2 API only). + * The "modifiers" structural property of this node type (type: {@link Integer}) (JLS2 API only). * @since 3.0 */ public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor(VariableDeclarationExpression.class, "modifiers", int.class, MANDATORY); //$NON-NLS-1$ /** - * The "modifiers" structural property of this node type (added in JLS3 API). + * The "modifiers" structural property of this node type (element type: {@link IExtendedModifier}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor(VariableDeclarationExpression.class, "modifiers", IExtendedModifier.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(VariableDeclarationExpression.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "fragments" structural property of this node type). + * The "fragments" structural property of this node type (element type: {@link VariableDeclarationFragment}). * @since 3.0 */ public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = @@ -124,7 +124,7 @@ public class VariableDeclarationExpression extends Expression { } /** - * The extended modifiers (element type: <code>IExtendedModifier</code>). + * The extended modifiers (element type: {@link IExtendedModifier}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.0 @@ -281,7 +281,7 @@ public class VariableDeclarationExpression extends Expression { * </p> * * @return the live list of modifiers and annotations - * (element type: <code>IExtendedModifier</code>) + * (element type: {@link IExtendedModifier}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -407,7 +407,7 @@ public class VariableDeclarationExpression extends Expression { * type of node will trigger an exception. * * @return the live list of variable declaration fragments in this - * expression (element type: <code>VariableDeclarationFragment</code>) + * expression (element type: {@link VariableDeclarationFragment}) */ public List fragments() { return this.variableDeclarationFragments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java index 559e5adec..e9de7c892 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -32,21 +32,21 @@ import java.util.List; public class VariableDeclarationFragment extends VariableDeclaration { /** - * The "name" structural property of this node type. + * The "name" structural property of this node type (child type: {@link SimpleName}). * @since 3.0 */ public static final ChildPropertyDescriptor NAME_PROPERTY = new ChildPropertyDescriptor(VariableDeclarationFragment.class, "name", SimpleName.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "extraDimensions" structural property of this node type. + * The "extraDimensions" structural property of this node type (type: {@link Integer}). * @since 3.0 */ public static final SimplePropertyDescriptor EXTRA_DIMENSIONS_PROPERTY = new SimplePropertyDescriptor(VariableDeclarationFragment.class, "extraDimensions", int.class, MANDATORY); //$NON-NLS-1$ /** - * The "initializer" structural property of this node type. + * The "initializer" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor INITIALIZER_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java index 21336c042..99c185acf 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -48,28 +48,28 @@ import java.util.List; public class VariableDeclarationStatement extends Statement { /** - * The "modifiers" structural property of this node type (JLS2 API only). + * The "modifiers" structural property of this node type (type: {@link Integer}) (JLS2 API only). * @since 3.0 */ public static final SimplePropertyDescriptor MODIFIERS_PROPERTY = new SimplePropertyDescriptor(VariableDeclarationStatement.class, "modifiers", int.class, MANDATORY); //$NON-NLS-1$ /** - * The "modifiers" structural property of this node type (added in JLS3 API). + * The "modifiers" structural property of this node type (element type: {@link IExtendedModifier}) (added in JLS3 API). * @since 3.1 */ public static final ChildListPropertyDescriptor MODIFIERS2_PROPERTY = new ChildListPropertyDescriptor(VariableDeclarationStatement.class, "modifiers", IExtendedModifier.class, CYCLE_RISK); //$NON-NLS-1$ /** - * The "type" structural property of this node type. + * The "type" structural property of this node type (child type: {@link Type}). * @since 3.0 */ public static final ChildPropertyDescriptor TYPE_PROPERTY = new ChildPropertyDescriptor(VariableDeclarationStatement.class, "type", Type.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$ /** - * The "fragments" structural property of this node type). + * The "fragments" structural property of this node type (element type: {@link VariableDeclarationFragment}). * @since 3.0 */ public static final ChildListPropertyDescriptor FRAGMENTS_PROPERTY = @@ -127,7 +127,7 @@ public class VariableDeclarationStatement extends Statement { } /** - * The extended modifiers (element type: <code>IExtendedModifier</code>). + * The extended modifiers (element type: {@link IExtendedModifier}). * Null in JLS2. Added in JLS3; defaults to an empty list * (see constructor). * @since 3.1 @@ -284,7 +284,7 @@ public class VariableDeclarationStatement extends Statement { * </p> * * @return the live list of modifiers and annotations - * (element type: <code>IExtendedModifier</code>) + * (element type: {@link IExtendedModifier}) * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 @@ -410,7 +410,7 @@ public class VariableDeclarationStatement extends Statement { * exception. * * @return the live list of variable declaration fragments in this - * statement (element type: <code>VariableDeclarationFragment</code>) + * statement (element type: {@link VariableDeclarationFragment}) */ public List fragments() { return this.variableDeclarationFragments; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WhileStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WhileStatement.java index 4fa9e3d2a..d7e04cf81 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WhileStatement.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WhileStatement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -28,14 +28,14 @@ import java.util.List; public class WhileStatement extends Statement { /** - * The "expression" structural property of this node type. + * The "expression" structural property of this node type (child type: {@link Expression}). * @since 3.0 */ public static final ChildPropertyDescriptor EXPRESSION_PROPERTY = new ChildPropertyDescriptor(WhileStatement.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$ /** - * The "body" structural property of this node type. + * The "body" structural property of this node type (child type: {@link Statement}). * @since 3.0 */ public static final ChildPropertyDescriptor BODY_PROPERTY = diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java index 6d50ff36b..89abb28ea 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 IBM Corporation and others. + * Copyright (c) 2003, 2010 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 @@ -32,13 +32,13 @@ import java.util.List; public class WildcardType extends Type { /** - * The "bound" structural property of this node type. + * The "bound" structural property of this node type (child type: {@link Type}). */ public static final ChildPropertyDescriptor BOUND_PROPERTY = new ChildPropertyDescriptor(WildcardType.class, "bound", Type.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$ /** - * The "upperBound" structural property of this node type. + * The "upperBound" structural property of this node type (type: {@link Boolean}). */ public static final SimplePropertyDescriptor UPPER_BOUND_PROPERTY = new SimplePropertyDescriptor(WildcardType.class, "upperBound", boolean.class, MANDATORY); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java index ecf7e1c50..3729dc064 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java @@ -171,7 +171,7 @@ public class ASTRewrite { * on record. Subsequence modifications are added to the ones * already on record. If this method is called again later, * the resulting text edit object will accurately reflect - * the net cumulative affect of all those changes. + * the net cumulative effect of all those changes. * </p> * * @param document original document containing source code @@ -226,7 +226,7 @@ public class ASTRewrite { * on record. Subsequence modifications are added to the ones * already on record. If this method is called again later, * the resulting text edit object will accurately reflect - * the net cumulative affect of all those changes. + * the net cumulative effect of all those changes. * </p> * * @return text edit object describing the changes to the diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java index cda1d94c3..e7c64952b 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java @@ -1062,7 +1062,7 @@ public final class ImportRewrite { * <p> * Calling this methods does not discard the modifications on record. Subsequence modifications are added * to the ones already on record. If this method is called again later, the resulting text edit object will accurately - * reflect the net cumulative affect of all those changes. + * reflect the net cumulative effect of all those changes. * </p> * @param monitor the progress monitor or <code>null</code> * @return text edit object describing the changes to the document corresponding to the changes diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java index 952692dbe..d3908a298 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java @@ -5,7 +5,7 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * $Id: NaiveASTFlattener.java 22567 2009-09-22 16:34:06Z stephan $ - * + * * Contributors: * IBM Corporation - initial API and implementation * Fraunhofer FIRST - extended API and implementation @@ -36,7 +36,7 @@ import org.eclipse.jdt.core.dom.*; * Call the <code>reset</code> method to clear the previous result before reusing an * existing instance. * </p> - * + * * @since 2.0 */ public class NaiveASTFlattener extends ASTVisitor { @@ -47,22 +47,22 @@ public class NaiveASTFlattener extends ASTVisitor { * @since 3.4 */ private static final int JLS2 = AST.JLS2; - + /** * The string buffer into which the serialized representation of the AST is * written. */ protected StringBuffer buffer; - + private int indent = 0; - + /** * Creates a new AST printer. */ public NaiveASTFlattener() { this.buffer = new StringBuffer(); } - + /** * Internal synonym for {@link ClassInstanceCreation#getName()}. Use to alleviate * deprecation warnings. @@ -72,16 +72,16 @@ public class NaiveASTFlattener extends ASTVisitor { private Name getName(ClassInstanceCreation node) { return node.getName(); } - + /** * Returns the string accumulated in the visit. * - * @return the serialized + * @return the serialized */ public String getResult() { return this.buffer.toString(); } - + /** * Internal synonym for {@link MethodDeclaration#getReturnType()}. Use to alleviate * deprecation warnings. @@ -91,7 +91,7 @@ public class NaiveASTFlattener extends ASTVisitor { private Type getReturnType(MethodDeclaration node) { return node.getReturnType(); } - + /** * Internal synonym for {@link TypeDeclaration#getSuperclass()}. Use to alleviate * deprecation warnings. @@ -100,8 +100,8 @@ public class NaiveASTFlattener extends ASTVisitor { */ private Name getSuperclass(TypeDeclaration node) { return node.getSuperclass(); - } - + } + /** * Internal synonym for {@link TypeDeclarationStatement#getTypeDeclaration()}. Use to alleviate * deprecation warnings. @@ -110,17 +110,17 @@ public class NaiveASTFlattener extends ASTVisitor { */ private TypeDeclaration getTypeDeclaration(TypeDeclarationStatement node) { return node.getTypeDeclaration(); - } - + } + void printIndent() { - for (int i = 0; i < this.indent; i++) + for (int i = 0; i < this.indent; i++) this.buffer.append(" "); //$NON-NLS-1$ } - + /** * Appends the text representation of the given modifier flags, followed by a single space. * Used for JLS2 modifiers. - * + * * @param modifiers the modifier flags */ void printModifiers(int modifiers) { @@ -158,11 +158,11 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append("transient ");//$NON-NLS-1$ } } - + /** * Appends the text representation of the given modifier flags, followed by a single space. * Used for 3.0 modifiers and annotations. - * + * * @param ext the list of modifier and annotation nodes * (element type: <code>IExtendedModifiers</code>) */ @@ -807,7 +807,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.getRightOperand().accept(this); return false; } - + /* * @see ASTVisitor#visit(Javadoc) */ @@ -821,7 +821,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append("\n */\n");//$NON-NLS-1$ return false; } - + /* * @see ASTVisitor#visit(LabeledStatement) */ @@ -832,7 +832,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.getBody().accept(this); return false; } - + /* * @see ASTVisitor#visit(LineComment) * @since 3.0 @@ -841,7 +841,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append("//\n");//$NON-NLS-1$ return false; } - + /* * @see ASTVisitor#visit(MarkerAnnotation) * @since 3.1 @@ -851,7 +851,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.getTypeName().accept(this); return false; } - + /* * @see ASTVisitor#visit(MemberRef) * @since 3.0 @@ -864,7 +864,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.getName().accept(this); return false; } - + /* * @see ASTVisitor#visit(MemberValuePair) * @since 3.1 @@ -926,7 +926,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append(")");//$NON-NLS-1$ for (int i = 0; i < node.getExtraDimensions(); i++) { this.buffer.append("[]"); //$NON-NLS-1$ - } + } if (!node.thrownExceptions().isEmpty()) { this.buffer.append(" throws ");//$NON-NLS-1$ for (Iterator it = node.thrownExceptions().iterator(); it.hasNext(); ) { @@ -979,7 +979,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append(")");//$NON-NLS-1$ return false; } - + /* * @see ASTVisitor#visit(MethodRef) * @since 3.0 @@ -1001,7 +1001,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append(")");//$NON-NLS-1$ return false; } - + /* * @see ASTVisitor#visit(MethodRefParameter) * @since 3.0 @@ -1173,7 +1173,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append(";\n");//$NON-NLS-1$ return false; } - + /* * @see ASTVisitor#visit(SimpleName) */ @@ -1223,7 +1223,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.getName().accept(this); for (int i = 0; i < node.getExtraDimensions(); i++) { this.buffer.append("[]"); //$NON-NLS-1$ - } + } if (node.getInitializer() != null) { this.buffer.append("=");//$NON-NLS-1$ node.getInitializer().accept(this); @@ -1335,7 +1335,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.indent++; //decremented in visit(SwitchStatement) return false; } - + /* * @see ASTVisitor#visit(SwitchStatement) */ @@ -1355,7 +1355,7 @@ public class NaiveASTFlattener extends ASTVisitor { this.buffer.append("}\n");//$NON-NLS-1$ return false; } - + /* * @see ASTVisitor#visit(SynchronizedStatement) */ @@ -1671,14 +1671,14 @@ public class NaiveASTFlattener extends ASTVisitor { } return false; } - + //{ObjectTeams: visit methods for OT-specific types /* * @see ASTVisitor#visit(MethodSpec) */ @SuppressWarnings("nls") public boolean visit(MethodSpec node) - { + { if (node.getAST().apiLevel() == JLS2) throw new UnsupportedOperationException("JLS2 no longer supported for OT/J"); if (node.hasSignature()) @@ -1697,7 +1697,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.getReturnType2().accept(this); if (node.hasCovariantReturn()) buffer.append('+'); - buffer.append(" "); + buffer.append(" "); } node.getName().accept(this); if (node.hasSignature()) @@ -1715,30 +1715,30 @@ public class NaiveASTFlattener extends ASTVisitor { buffer.append(")"); } return false; - } - + } + /* * @see ASTVisitor#visit(FieldAccessSpec) */ @SuppressWarnings("nls") public boolean visit(FieldAccessSpec node) - { + { if (node.hasSignature()) { - node.getFieldType().accept(this); // TODO(SH): must this be updated similar to returnType2? + node.getFieldType().accept(this); // TODO(SH): must this be updated similar to returnType2? buffer.append(" "); } node.getName().accept(this); return false; - } - + } + /* * @see ASTVisitor#visit(CallinMappingDeclaration) */ @SuppressWarnings("nls") public boolean visit(CallinMappingDeclaration node) { - if (node.getJavadoc() != null) + if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } @@ -1755,7 +1755,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.callinModifier().accept(this); buffer.append(" "); } - + for (Iterator iter = node.getBaseMappingElements().iterator(); iter.hasNext();) { MethodSpec rightMethodSpec = (MethodSpec) iter.next(); @@ -1780,7 +1780,7 @@ public class NaiveASTFlattener extends ASTVisitor { guard.getExpression().accept(this); buffer.append(")"); } - + if (!node.getParameterMappings().isEmpty()) { buffer.append(" with\n{\n"); @@ -1800,7 +1800,7 @@ public class NaiveASTFlattener extends ASTVisitor { { buffer.append(";"); } - + return false; } @@ -1810,7 +1810,7 @@ public class NaiveASTFlattener extends ASTVisitor { @SuppressWarnings("nls") public boolean visit(CalloutMappingDeclaration node) { - if (node.getJavadoc() != null) + if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } @@ -1883,7 +1883,7 @@ public class NaiveASTFlattener extends ASTVisitor { node.getPath().accept(this); return false; } - + /* * @see ASTVisitor#visit(WithinStatement) */ @@ -1946,8 +1946,8 @@ public class NaiveASTFlattener extends ASTVisitor { return false; } - - + + /* * @see ASTVisitor#visit(BaseCallMessageSend) */ @@ -1969,7 +1969,7 @@ public class NaiveASTFlattener extends ASTVisitor { buffer.append(")"); return false; } - + /* * @see ASTVisitor#visit(BaseConstructorMessageSend) */ @@ -2095,8 +2095,8 @@ public class NaiveASTFlattener extends ASTVisitor { printIndent(); this.buffer.append("}\n");//$NON-NLS-1$ return false; - } - + } + /* * @see ASTVisitor#visit(PrecedenceDeclaration) */ @@ -2117,6 +2117,6 @@ public class NaiveASTFlattener extends ASTVisitor { return false; } //gbr+SH} - + } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java index 8fba01e80..e75a73733 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java @@ -85,17 +85,17 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { private final NodeInfoStore nodeInfos; private final TargetSourceRangeComputer extendedSourceRangeComputer; private final LineCommentEndOffsets lineCommentEndOffsets; - + private int beforeRequiredSpaceIndex = -1; - + Map options; - + private RecoveryScannerData recoveryScannerData; /** * Constructor for ASTRewriteAnalyzer. * <p>The given options cannot be null.</p> - * + * * @param content the content of the compilation unit to rewrite. * @param lineInfo line information for the content of the compilation unit to rewrite. * @param rootEdit the edit to add all generated edits to @@ -130,9 +130,9 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { this.extendedSourceRangeComputer = extendedSourceRangeComputer; this.lineCommentEndOffsets= new LineCommentEndOffsets(comments); - + this.options = options; - + this.recoveryScannerData = recoveryScannerData; } @@ -141,7 +141,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { CompilerOptions compilerOptions = new CompilerOptions(this.options); Scanner scanner; if (this.recoveryScannerData == null) { - scanner = + scanner = new Scanner( true,/*tokenizeComments*/ false,/*tokenizeWhiteSpace*/ @@ -502,7 +502,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { private boolean insertAfterSeparator(ASTNode node) { return !isInsertBoundToPrevious(node); } - + protected boolean mustRemoveSeparator(int originalOffset, int nodeIndex) { return true; } @@ -570,7 +570,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { if (separatorState == EXISTING) { updateIndent(prevMark, currPos, i, editGroup); } - + doTextInsert(currPos, node, getNodeIndent(i), true, editGroup); // insert node separatorState= NEW; @@ -589,6 +589,32 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { ASTNode node= (ASTNode) currEvent.getOriginalValue(); TextEditGroup editGroup= getEditGroup(currEvent); int currEnd= getEndOfNode(node); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=306524 + // Check for leading comments that are not part of extended range, and prevent them + // from getting removed. + try { + TokenScanner scanner = getScanner(); + int newOffset = prevEnd; + int extendedOffset = getExtendedOffset(node); + // Try to find the end of the last comment which is not part of extended source + // range of the node. + while (TokenScanner.isComment(scanner.readNext(newOffset, false))) { + int tempOffset = scanner.getNextEndOffset(newOffset, false); + // check whether the comment is part of extended source range of the node. + // If it is then we need to stop. + if (tempOffset < extendedOffset) { + newOffset = tempOffset; + } else { + break; + } + } + if (currPos < newOffset) { + currPos = extendedOffset; + } + prevEnd = newOffset; + } catch (CoreException e) { + // ignore + } if (i > lastNonDelete && separatorState == EXISTING) { // is last, remove previous separator: split delete to allow range copies doTextRemove(prevEnd, currPos - prevEnd, editGroup); // remove separator @@ -599,9 +625,28 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { if (i < lastNonDelete) { updateIndent(prevMark, currPos, i, editGroup); } - + // remove element and next separator int end= getStartOfNextNode(nextIndex, currEnd); // start of next + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=306524 + // Check for trailing comments that are not part of extended range, and prevent them + // from getting removed. + try { + TokenScanner scanner = getScanner(); + int nextToken= scanner.readNext(currEnd, false); + if (TokenScanner.isComment(nextToken)) { + // the separator also has comments that are not part of extended + // source range of this node or the next node. So dont remove the separator + if (end != scanner.getNextStartOffset(currEnd, false)) { + // If this condition were true, comments just found as part of the separator would've basically been + // part of the extended source range of the next node. So 'end' wud've safely been set to the correct position + // and no change is needed. + end = currEnd; + } + } + } catch (CoreException e) { + // ignore + } doTextRemoveAndVisit(currPos, currEnd - currPos, node, getEditGroup(currEvent)); // remove node if (mustRemoveSeparator(currPos, i)) { doTextRemove(currEnd, end - currEnd, editGroup); // remove separator @@ -617,9 +662,9 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { TextEditGroup editGroup= getEditGroup(currEvent); ASTNode changed= (ASTNode) currEvent.getNewValue(); - + updateIndent(prevMark, currPos, i, editGroup); - + doTextRemoveAndVisit(currPos, currEnd - currPos, node, editGroup); doTextInsert(currPos, changed, getNodeIndent(i), true, editGroup); @@ -645,12 +690,12 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { separatorState= EXISTING; } } - + prevMark = currMark; } return currPos; } - + protected void updateIndent(int prevMark, int originalOffset, int nodeIndex, TextEditGroup editGroup) { // Do nothing. } @@ -692,7 +737,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { case RewriteEvent.REMOVED: { ASTNode node= (ASTNode) event.getOriginalValue(); TextEditGroup editGroup= getEditGroup(event); - + // if there is a prefix, remove the prefix as well int nodeEnd; int len; @@ -894,7 +939,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { protected String getSeparatorString(int nodeIndex) { return getSeparatorString(nodeIndex, nodeIndex + 1); } - + protected String getSeparatorString(int nodeIndex, int nextNodeIndex) { int newLines= this.separatorLines == -1 ? getNewLines(nodeIndex) : this.separatorLines; @@ -968,17 +1013,17 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } return 0; } - + protected boolean mustRemoveSeparator(int originalOffset, int nodeIndex) { // Do not remove separator if the previous non removed node is on the same line and the next node is on another line int previousNonRemovedNodeIndex = nodeIndex - 1; while (previousNonRemovedNodeIndex >= 0 && this.list[previousNonRemovedNodeIndex].getChangeKind() == RewriteEvent.REMOVED) { previousNonRemovedNodeIndex--; } - + if (previousNonRemovedNodeIndex > -1) { LineInformation lineInformation = getLineInformation(); - + RewriteEvent prevEvent = this.list[previousNonRemovedNodeIndex]; int prevKind = prevEvent.getChangeKind(); if (prevKind == RewriteEvent.UNCHANGED || prevKind == RewriteEvent.REPLACED) { @@ -986,23 +1031,23 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { int prevEndPosition = prevNode.getStartPosition() + prevNode.getLength(); int prevLine = lineInformation.getLineOfOffset(prevEndPosition); int line = lineInformation.getLineOfOffset(originalOffset); - + if (prevLine == line && nodeIndex + 1 < this.list.length) { RewriteEvent nextEvent = this.list[nodeIndex + 1]; int nextKind = nextEvent.getChangeKind(); - + if (nextKind == RewriteEvent.UNCHANGED || prevKind == RewriteEvent.REPLACED) { ASTNode nextNode = (ASTNode) nextEvent.getOriginalValue(); int nextStartPosition = nextNode.getStartPosition(); int nextLine = lineInformation.getLineOfOffset(nextStartPosition); - + return nextLine == line; } return false; } } } - + return true; } } @@ -1447,7 +1492,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { addEdit(edit); this.currentEdit= edit; } - + ensureSpaceBeforeReplace(node); } @@ -1746,13 +1791,13 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { public boolean visit(ReturnStatement node) { try { this.beforeRequiredSpaceIndex = getScanner().getTokenEndOffset(TerminalTokens.TokenNamereturn, node.getStartPosition()); - + if (!hasChildrenChanges(node)) { return doVisitUnchangedChildren(node); } - + ensureSpaceBeforeReplace(node); - + rewriteNode(node, ReturnStatement.EXPRESSION_PROPERTY, this.beforeRequiredSpaceIndex, ASTRewriteFormatter.SPACE); } catch (CoreException e) { handleException(e); @@ -1933,13 +1978,13 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { public boolean visit(AssertStatement node) { try { this.beforeRequiredSpaceIndex = getScanner().getNextEndOffset(node.getStartPosition(), true); - + if (!hasChildrenChanges(node)) { return doVisitUnchangedChildren(node); } - + ensureSpaceBeforeReplace(node); - + int offset= rewriteRequiredNode(node, AssertStatement.EXPRESSION_PROPERTY); rewriteNode(node, AssertStatement.MESSAGE_PROPERTY, offset, ASTRewriteFormatter.ASSERT_COMMENT); } catch (CoreException e) { @@ -2284,7 +2329,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { try { int tok= getScanner().readNext(pos, true); // after the closing parent pos= (tok == TerminalTokens.TokenNameRPAREN) ? getScanner().getCurrentEndOffset() : getScanner().getCurrentStartOffset(); - + int indent= getIndent(node.getStartPosition()); int endPos= -1; @@ -2478,12 +2523,12 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } } } - + public void ensureSpaceBeforeReplace(ASTNode node) { if (this.beforeRequiredSpaceIndex == -1) return; - + List events = this.eventStore.getChangedPropertieEvents(node); - + for (Iterator iterator = events.iterator(); iterator.hasNext();) { RewriteEvent event = (RewriteEvent) iterator.next(); if (event.getChangeKind() == RewriteEvent.REPLACED && event.getOriginalValue() instanceof ASTNode) { @@ -2494,7 +2539,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } } } - + if (this.beforeRequiredSpaceIndex < getExtendedOffset(node)) { this.beforeRequiredSpaceIndex = -1; } @@ -2846,39 +2891,39 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } class SwitchListRewriter extends ParagraphListRewriter { - + private boolean indentSwitchStatementsCompareToCases; public SwitchListRewriter(int initialIndent) { super(initialIndent, 0); - this.indentSwitchStatementsCompareToCases = + this.indentSwitchStatementsCompareToCases = DefaultCodeFormatterConstants.TRUE.equals(ASTRewriteAnalyzer.this.options.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES)); } protected int getNodeIndent(int nodeIndex) { int indent= getInitialIndent(); - + if (this.indentSwitchStatementsCompareToCases) { RewriteEvent event = this.list[nodeIndex]; int changeKind = event.getChangeKind(); - + ASTNode node; if (changeKind == RewriteEvent.INSERTED || changeKind == RewriteEvent.REPLACED) { node= (ASTNode)event.getNewValue(); } else { node= (ASTNode)event.getOriginalValue(); } - + if (node.getNodeType() != ASTNode.SWITCH_CASE) { indent++; } } return indent; } - + protected String getSeparatorString(int nodeIndex) { int total = this.list.length; - + int nextNodeIndex = nodeIndex + 1; while (nextNodeIndex < total && this.list[nextNodeIndex].getChangeKind() == RewriteEvent.REMOVED) { nextNodeIndex++; @@ -2888,19 +2933,19 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } return getSeparatorString(nodeIndex, nextNodeIndex); } - + protected void updateIndent(int prevMark, int originalOffset, int nodeIndex, TextEditGroup editGroup) { if (prevMark != RewriteEvent.UNCHANGED && prevMark != RewriteEvent.REPLACED) return; - + // Do not change indent if the previous non removed node is on the same line int previousNonRemovedNodeIndex = nodeIndex - 1; while (previousNonRemovedNodeIndex >= 0 && this.list[previousNonRemovedNodeIndex].getChangeKind() == RewriteEvent.REMOVED) { previousNonRemovedNodeIndex--; } - + if (previousNonRemovedNodeIndex > -1) { LineInformation lineInformation = getLineInformation(); - + RewriteEvent prevEvent = this.list[previousNonRemovedNodeIndex]; int prevKind = prevEvent.getChangeKind(); if (prevKind == RewriteEvent.UNCHANGED || prevKind == RewriteEvent.REPLACED) { @@ -2908,27 +2953,27 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { int prevEndPosition = prevNode.getStartPosition() + prevNode.getLength(); int prevLine = lineInformation.getLineOfOffset(prevEndPosition); int line = lineInformation.getLineOfOffset(originalOffset); - + if (prevLine == line) { return; } } } - + int total = this.list.length; while (nodeIndex < total && this.list[nodeIndex].getChangeKind() == RewriteEvent.REMOVED) { nodeIndex++; } - + int originalIndent = getIndent(originalOffset); int newIndent = getNodeIndent(nodeIndex); - + if (originalIndent != newIndent) { - + int line= getLineInformation().getLineOfOffset(originalOffset); if (line >= 0) { int lineStart= getLineInformation().getLineOffset(line); - + doTextRemove(lineStart, originalOffset - lineStart, editGroup); // remove previous indentation doTextInsert(lineStart, createIndentString(newIndent), editGroup); // add new indentation } @@ -2954,7 +2999,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { if (DefaultCodeFormatterConstants.TRUE.equals(this.options.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH))) { insertIndent++; } - + ParagraphListRewriter listRewriter= new SwitchListRewriter(insertIndent); StringBuffer leadString= new StringBuffer(); leadString.append(getLineDelimiter()); @@ -3000,11 +3045,11 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { public boolean visit(ThrowStatement node) { try { this.beforeRequiredSpaceIndex = getScanner().getTokenEndOffset(TerminalTokens.TokenNamethrow, node.getStartPosition()); - + if (!hasChildrenChanges(node)) { return doVisitUnchangedChildren(node); } - + ensureSpaceBeforeReplace(node); rewriteRequiredNode(node, ThrowStatement.EXPRESSION_PROPERTY); @@ -3449,7 +3494,22 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { String str= this.formatter.FIRST_ENUM_CONST.getPrefix(indent - 1); doTextInsert(pos, str, getEditGroup(children[0])); } - doTextInsert(pos, ";", getEditGroup(children[0])); //$NON-NLS-1$ + if (token == TerminalTokens.TokenNameCOMMA) { + // a comma is at the end of the enum constant before a potential semicolon + int endPos= getScanner().getCurrentEndOffset(); + int nextToken= getScanner().readNext(endPos, true); + if (nextToken != TerminalTokens.TokenNameSEMICOLON) { + doTextInsert(endPos, ";", getEditGroup(children[0])); //$NON-NLS-1$ + } else { + endPos= getScanner().getCurrentEndOffset(); + if (isAllOfKind(children, RewriteEvent.REMOVED)) { + doTextRemove(pos, endPos - pos, getEditGroup(children[0])); + } + } + pos= endPos; + } else { + doTextInsert(pos, ";", getEditGroup(children[0])); //$NON-NLS-1$ + } } else if (hasSemicolon) { int endPos= getScanner().getCurrentEndOffset(); if (isAllOfKind(children, RewriteEvent.REMOVED)) { @@ -4115,8 +4175,8 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { if (changedBindingKind) { String str = ""; switch ((Integer)this.eventStore.getNewValue(node, MethodBindingOperator.BINDING_KIND_PROPERTY)) { - case MethodBindingOperator.KIND_CALLIN : str = CallinMappingDeclaration.CALLIN; break; - case MethodBindingOperator.KIND_CALLOUT : str = CalloutMappingDeclaration.CALLOUT; break; + case MethodBindingOperator.KIND_CALLIN : str = CallinMappingDeclaration.CALLIN; break; + case MethodBindingOperator.KIND_CALLOUT : str = CalloutMappingDeclaration.CALLOUT; break; case MethodBindingOperator.KIND_CALLOUT_OVERRIDE : str = CalloutMappingDeclaration.CALLOUT_OVERRIDE; break; } doTextReplace(pos, 2, str, getEditGroup(node, MethodBindingOperator.BINDING_KIND_PROPERTY)); @@ -4143,14 +4203,14 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { else addSignature = (Boolean)signatureEvent.getNewValue(); } - + int pos= node.getStartPosition(); // type parameters if (node.getAST().apiLevel() == AST.JLS3) pos= rewriteOptionalTypeParameters(node, MethodSpec.TYPE_PARAMETERS_PROPERTY, pos, String.valueOf(' '), true, pos != node.getStartPosition()); // return type - pos= rewriteNode(node, MethodSpec.RETURN_TYPE2_PROPERTY, pos, + pos= rewriteNode(node, MethodSpec.RETURN_TYPE2_PROPERTY, pos, pos == node.getStartPosition() ? ASTRewriteFormatter.NONE : ASTRewriteFormatter.SPACE); try { // add/remove whitespace upto next token @@ -4163,14 +4223,14 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } } catch (CoreException e) { // ignore - } + } // method name pos= rewriteRequiredNode(node, MethodSpec.NAME_PROPERTY); // parameters try { - boolean newHasSignature = (signatureEvent != null) + boolean newHasSignature = (signatureEvent != null) ? signatureEvent.getNewValue() == Boolean.TRUE : node.hasSignature(); if (newHasSignature) { @@ -4217,7 +4277,7 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { else addSignature = (Boolean)signatureEvent.getNewValue(); } - + int pos= node.getStartPosition(); // field type @@ -4233,8 +4293,8 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } } catch (CoreException e) { // ignore - } - + } + // field name pos= rewriteRequiredNode(node, FieldAccessSpec.NAME_PROPERTY); diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java index 54177a600..a10ddffa8 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java @@ -19,14 +19,14 @@ import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.internal.compiler.util.Util; public class ASTRewriteFlattener extends ASTVisitor { - + /** * Internal synonynm for deprecated constant AST.JSL2 * to alleviate deprecation warnings. * @deprecated */ /*package*/ static final int JLS2_INTERNAL = AST.JLS2; - + public static String asString(ASTNode node, RewriteEventStore store) { ASTRewriteFlattener flattener= new ASTRewriteFlattener(store); node.accept(flattener); @@ -40,27 +40,27 @@ public class ASTRewriteFlattener extends ASTVisitor { this.store= store; this.result= new StringBuffer(); } - + /** * Returns the string accumulated in the visit. * - * @return the serialized + * @return the serialized */ public String getResult() { // convert to a string, but lose any extra space in the string buffer by copying return new String(this.result.toString()); } - + /** * Resets this printer so that it can be used again. */ public void reset() { this.result.setLength(0); } - + /** * Appends the text representation of the given modifier flags, followed by a single space. - * + * * @param modifiers the modifiers * @param buf The <code>StringBuffer</code> to write the result to. */ @@ -99,7 +99,7 @@ public class ASTRewriteFlattener extends ASTVisitor { buf.append("transient "); //$NON-NLS-1$ } -//{ObjectTeams: printModifier for OT-specific modifiers +//{ObjectTeams: printModifier for OT-specific modifiers if (Modifier.isReplace(modifiers)) { buf.append("replace "); //$NON-NLS-1$ @@ -111,7 +111,7 @@ public class ASTRewriteFlattener extends ASTVisitor { if (Modifier.isAfter(modifiers)) { buf.append("after "); //$NON-NLS-1$ - } + } if (Modifier.isGet(modifiers)) { buf.append("get "); //$NON-NLS-1$ @@ -129,29 +129,29 @@ public class ASTRewriteFlattener extends ASTVisitor { buf.append("callin "); //$NON-NLS-1$ } // jsv} - + } - + protected List getChildList(ASTNode parent, StructuralPropertyDescriptor childProperty) { return (List) getAttribute(parent, childProperty); } - + protected ASTNode getChildNode(ASTNode parent, StructuralPropertyDescriptor childProperty) { return (ASTNode) getAttribute(parent, childProperty); } - + protected int getIntAttribute(ASTNode parent, StructuralPropertyDescriptor childProperty) { return ((Integer) getAttribute(parent, childProperty)).intValue(); } - + protected boolean getBooleanAttribute(ASTNode parent, StructuralPropertyDescriptor childProperty) { return ((Boolean) getAttribute(parent, childProperty)).booleanValue(); } - + protected Object getAttribute(ASTNode parent, StructuralPropertyDescriptor childProperty) { return this.store.getNewValue(parent, childProperty); } - + protected void visitList(ASTNode parent, StructuralPropertyDescriptor childProperty, String separator) { List list= getChildList(parent, childProperty); for (int i= 0; i < list.size(); i++) { @@ -161,7 +161,7 @@ public class ASTRewriteFlattener extends ASTVisitor { ((ASTNode) list.get(i)).accept(this); } } - + protected void visitList(ASTNode parent, StructuralPropertyDescriptor childProperty, String separator, String lead, String post) { List list= getChildList(parent, childProperty); if (!list.isEmpty()) { @@ -175,8 +175,8 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append(post); } } - - + + /* * @see ASTVisitor#visit(AnonymousClassDeclaration) */ @@ -204,7 +204,7 @@ public class ASTRewriteFlattener extends ASTVisitor { public boolean visit(ArrayCreation node) { this.result.append("new "); //$NON-NLS-1$ ArrayType arrayType= (ArrayType) getChildNode(node, ArrayCreation.TYPE_PROPERTY); - + // get the element type and count dimensions Type elementType= (Type) getChildNode(arrayType, ArrayType.COMPONENT_TYPE_PROPERTY); int dimensions= 1; // always include this array type @@ -212,9 +212,9 @@ public class ASTRewriteFlattener extends ASTVisitor { dimensions++; elementType = (Type) getChildNode(elementType, ArrayType.COMPONENT_TYPE_PROPERTY); } - + elementType.accept(this); - + List list= getChildList(node, ArrayCreation.DIMENSIONS_PROPERTY); for (int i= 0; i < list.size(); i++) { this.result.append('['); @@ -222,7 +222,7 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append(']'); dimensions--; } - + // add empty "[]" for each extra array dimension for (int i= 0; i < dimensions; i++) { this.result.append("[]"); //$NON-NLS-1$ @@ -233,7 +233,7 @@ public class ASTRewriteFlattener extends ASTVisitor { } return false; } - + /* * @see ASTVisitor#visit(ArrayInitializer) */ @@ -259,7 +259,7 @@ public class ASTRewriteFlattener extends ASTVisitor { public boolean visit(AssertStatement node) { this.result.append("assert "); //$NON-NLS-1$ getChildNode(node, AssertStatement.EXPRESSION_PROPERTY).accept(this); - + ASTNode message= getChildNode(node, AssertStatement.MESSAGE_PROPERTY); if (message != null) { this.result.append(':'); @@ -551,11 +551,11 @@ public class ASTRewriteFlattener extends ASTVisitor { getChildNode(node, InfixExpression.LEFT_OPERAND_PROPERTY).accept(this); this.result.append(' '); String operator= getAttribute(node, InfixExpression.OPERATOR_PROPERTY).toString(); - + this.result.append(operator); this.result.append(' '); getChildNode(node, InfixExpression.RIGHT_OPERAND_PROPERTY).accept(this); - + List list= getChildList(node, InfixExpression.EXTENDED_OPERANDS_PROPERTY); for (int i= 0; i < list.size(); i++) { this.result.append(operator); @@ -629,7 +629,7 @@ public class ASTRewriteFlattener extends ASTVisitor { visitList(node, MethodDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); visitList(node, MethodDeclaration.TYPE_PARAMETERS_PROPERTY, String.valueOf(','), String.valueOf('<'), String.valueOf('>')); } - + if (!getBooleanAttribute(node, MethodDeclaration.CONSTRUCTOR_PROPERTY)) { if (node.getAST().apiLevel() == JLS2_INTERNAL) { getChildNode(node, MethodDeclaration.RETURN_TYPE_PROPERTY).accept(this); @@ -651,9 +651,9 @@ public class ASTRewriteFlattener extends ASTVisitor { int extraDims= getIntAttribute(node, MethodDeclaration.EXTRA_DIMENSIONS_PROPERTY); for (int i = 0; i < extraDims; i++) { this.result.append("[]"); //$NON-NLS-1$ - } + } visitList(node, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY, String.valueOf(','), " throws ", Util.EMPTY_STRING); //$NON-NLS-1$ -//{ObjectTeams: predicate +//{ObjectTeams: predicate ASTNode guardPredicate = getChildNode(node, MethodDeclaration.GUARD_PROPERTY); if (guardPredicate != null) { guardPredicate.accept(this); @@ -817,7 +817,7 @@ public class ASTRewriteFlattener extends ASTVisitor { int extraDimensions= getIntAttribute(node, SingleVariableDeclaration.EXTRA_DIMENSIONS_PROPERTY); for (int i = 0; i < extraDimensions; i++) { this.result.append("[]"); //$NON-NLS-1$ - } + } ASTNode initializer= getChildNode(node, SingleVariableDeclaration.INITIALIZER_PROPERTY); if (initializer != null) { this.result.append('='); @@ -969,7 +969,7 @@ public class ASTRewriteFlattener extends ASTVisitor { */ public boolean visit(TypeDeclaration node) { int apiLevel= node.getAST().apiLevel(); - + ASTNode javadoc= getChildNode(node, TypeDeclaration.JAVADOC_PROPERTY); if (javadoc != null) { javadoc.accept(this); @@ -980,7 +980,7 @@ public class ASTRewriteFlattener extends ASTVisitor { } else { visitList(node, TypeDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); } - + boolean isInterface= getBooleanAttribute(node, TypeDeclaration.INTERFACE_PROPERTY); this.result.append(isInterface ? "interface " : "class "); //$NON-NLS-1$ //$NON-NLS-2$ getChildNode(node, TypeDeclaration.NAME_PROPERTY).accept(this); @@ -989,7 +989,7 @@ public class ASTRewriteFlattener extends ASTVisitor { } this.result.append(' '); - + ChildPropertyDescriptor superClassProperty= (apiLevel == JLS2_INTERNAL) ? TypeDeclaration.SUPERCLASS_PROPERTY : TypeDeclaration.SUPERCLASS_TYPE_PROPERTY; ASTNode superclass= getChildNode(node, superClassProperty); if (superclass != null) { @@ -997,7 +997,7 @@ public class ASTRewriteFlattener extends ASTVisitor { superclass.accept(this); this.result.append(' '); } - + ChildListPropertyDescriptor superInterfaceProperty= (apiLevel == JLS2_INTERNAL) ? TypeDeclaration.SUPER_INTERFACES_PROPERTY : TypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY; String lead= isInterface ? "extends " : "implements "; //$NON-NLS-1$//$NON-NLS-2$ visitList(node, superInterfaceProperty, String.valueOf(','), lead, Util.EMPTY_STRING); @@ -1096,8 +1096,8 @@ public class ASTRewriteFlattener extends ASTVisitor { getChildNode(node, WhileStatement.BODY_PROPERTY).accept(this); return false; } - - + + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BlockComment) */ @@ -1198,11 +1198,11 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append("@interface ");//$NON-NLS-1$ getChildNode(node, AnnotationTypeDeclaration.NAME_PROPERTY).accept(this); this.result.append('{'); - visitList(node, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY, Util.EMPTY_STRING); + visitList(node, AnnotationTypeDeclaration.BODY_DECLARATIONS_PROPERTY, Util.EMPTY_STRING); this.result.append('}'); return false; } - + /* * @see ASTVisitor#visit(AnnotationTypeMemberDeclaration) * @since 3.0 @@ -1289,7 +1289,7 @@ public class ASTRewriteFlattener extends ASTVisitor { getChildNode(node, MarkerAnnotation.TYPE_NAME_PROPERTY).accept(this); return false; } - + /* * @see ASTVisitor#visit(MemberValuePair) * @since 3.0 @@ -1308,7 +1308,7 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append(getAttribute(node, Modifier.KEYWORD_PROPERTY).toString()); return false; } - + /* * @see ASTVisitor#visit(NormalAnnotation) * @since 3.0 @@ -1369,7 +1369,7 @@ public class ASTRewriteFlattener extends ASTVisitor { visitList(node, TypeParameter.TYPE_BOUNDS_PROPERTY, " & ", " extends ", Util.EMPTY_STRING); //$NON-NLS-1$ //$NON-NLS-2$ return false; } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.WildcardType) */ @@ -1387,7 +1387,7 @@ public class ASTRewriteFlattener extends ASTVisitor { return false; } //{ObjectTeams: visit methods for OT-specific types - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.FieldAccessSpec) */ @@ -1395,20 +1395,20 @@ public class ASTRewriteFlattener extends ASTVisitor { { if (node.hasSignature()) { - getChildNode(node, FieldAccessSpec.FIELD_TYPE_PROPERTY).accept(this); + getChildNode(node, FieldAccessSpec.FIELD_TYPE_PROPERTY).accept(this); this.result.append(' '); } getChildNode(node, FieldAccessSpec.NAME_PROPERTY).accept(this); - + return false; - } - + } + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.MethodSpec) */ public boolean visit(MethodSpec node) - { + { if (node.hasSignature()) { if(node.getAST().apiLevel() == AST.JLS3) { @@ -1423,7 +1423,7 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append('+'); this.result.append(' '); } - + getChildNode(node, MethodSpec.NAME_PROPERTY).accept(this); if (node.hasSignature()) @@ -1432,9 +1432,9 @@ public class ASTRewriteFlattener extends ASTVisitor { visitList(node, MethodSpec.PARAMETERS_PROPERTY, ", "); //$NON-NLS-1$ this.result.append(')'); } - + return false; - } + } /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.CalloutMappingDeclaration) @@ -1446,12 +1446,12 @@ public class ASTRewriteFlattener extends ASTVisitor { if (javadoc != null) { javadoc.accept(this); } - + visitList(node, CalloutMappingDeclaration.MODIFIERS2_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' ')); - + ASTNode roleMappingElement = getChildNode(node, CalloutMappingDeclaration.ROLE_MAPPING_ELEMENT_PROPERTY); ASTNode baseMappingElement = getChildNode(node, CalloutMappingDeclaration.BASE_MAPPING_ELEMENT_PROPERTY); - + if (roleMappingElement != null && baseMappingElement != null) { @@ -1465,7 +1465,7 @@ public class ASTRewriteFlattener extends ASTVisitor { { node.setFlags(ASTNode.MALFORMED); } - + if (!node.getParameterMappings().isEmpty()) { this.result.append(" with {\n "); @@ -1489,10 +1489,10 @@ public class ASTRewriteFlattener extends ASTVisitor { if (javadoc != null) { javadoc.accept(this); } - + ASTNode roleMappingElement = getChildNode(node, CallinMappingDeclaration.ROLE_MAPPING_ELEMENT_PROPERTY); List baseMappingElement = getChildList(node, CallinMappingDeclaration.BASE_MAPPING_ELEMENTS_PROPERTY); - + if ( roleMappingElement != null && baseMappingElement != null) { @@ -1513,13 +1513,13 @@ public class ASTRewriteFlattener extends ASTVisitor { { node.setFlags(ASTNode.MALFORMED); } - + ASTNode guardPredicate = getChildNode(node, CallinMappingDeclaration.GUARD_PROPERTY); if (guardPredicate != null) { this.result.append(' '); guardPredicate.accept(this); } - + if (!node.getParameterMappings().isEmpty()) { this.result.append(" with {\n "); @@ -1530,7 +1530,7 @@ public class ASTRewriteFlattener extends ASTVisitor { { this.result.append(';'); } - + return false; } @@ -1549,7 +1549,7 @@ public class ASTRewriteFlattener extends ASTVisitor { } return false; } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.LiftingType) */ @@ -1560,7 +1560,7 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append("as"); //$NON-NLS-1$ this.result.append(' '); getChildNode(node, LiftingType.ROLE_TYPE_PROPERTY).accept(this); - + return false; } @@ -1571,10 +1571,10 @@ public class ASTRewriteFlattener extends ASTVisitor { { this.result.append('@'); getChildNode(node, TypeAnchor.PATH_PROPERTY).accept(this); - + return false; } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.WithinStatement) */ @@ -1588,7 +1588,7 @@ public class ASTRewriteFlattener extends ASTVisitor { return false; } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TSuperMessageSend) */ @@ -1605,11 +1605,11 @@ public class ASTRewriteFlattener extends ASTVisitor { visitList(node, TSuperMessageSend.ARGUMENTS_PROPERTY, String.valueOf(',')); this.result.append(')'); this.result.append(';'); - - + + return false; } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.TSuperConstructorInvocation) */ @@ -1620,7 +1620,7 @@ public class ASTRewriteFlattener extends ASTVisitor { visitList(node, TSuperConstructorInvocation.ARGUMENTS_PROPERTY, String.valueOf(',')); this.result.append(')'); this.result.append(';'); - + return false; } /* (non-Javadoc) @@ -1633,10 +1633,10 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append('('); visitList(node, BaseCallMessageSend.ARGUMENTS_PROPERTY, String.valueOf(',')); this.result.append(')'); - + return false; } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.BaseConstructorMessageSend) */ @@ -1647,10 +1647,10 @@ public class ASTRewriteFlattener extends ASTVisitor { visitList(node, BaseConstructorInvocation.ARGUMENTS_PROPERTY, String.valueOf(',')); this.result.append(')'); this.result.append(';'); - + return false; } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ParameterMapping) */ @@ -1659,7 +1659,7 @@ public class ASTRewriteFlattener extends ASTVisitor { { if (node.getExpression() != null) { - if (node.getDirection().equals("->")) + if (node.getDirection().equals("->")) { getChildNode(node, ParameterMapping.EXPRESSION_PROPERTY).accept(this); this.result.append(" "); @@ -1667,7 +1667,7 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append(" "); this.result.append(node.getIdentifier()); } - if (node.getDirection().equals("<-")) + if (node.getDirection().equals("<-")) { this.result.append(node.getIdentifier()); this.result.append(" "); @@ -1681,7 +1681,7 @@ public class ASTRewriteFlattener extends ASTVisitor { /* * @see ASTVisitor#visit(RoleTypeDeclaration) */ - public boolean visit(RoleTypeDeclaration node) + public boolean visit(RoleTypeDeclaration node) { ASTNode javadoc= getChildNode(node, RoleTypeDeclaration.JAVADOC_PROPERTY); if (javadoc != null) @@ -1697,7 +1697,7 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append("class "); //$NON-NLS-1$ getChildNode(node, RoleTypeDeclaration.NAME_PROPERTY).accept(this); this.result.append(' '); - + ASTNode superclass = getChildNode(node, RoleTypeDeclaration.SUPERCLASS_TYPE_PROPERTY); if (superclass != null) { @@ -1708,20 +1708,20 @@ public class ASTRewriteFlattener extends ASTVisitor { String lead= "implements "; //$NON-NLS-1$ visitList(node, RoleTypeDeclaration.SUPER_INTERFACE_TYPES_PROPERTY, String.valueOf(','), lead, Util.EMPTY_STRING); - + ASTNode baseClass = getChildNode(node, RoleTypeDeclaration.BASECLASS_TYPE_PROPERTY); if (baseClass != null) { this.result.append("playedBy "); //$NON-NLS-1$ baseClass.accept(this); - this.result.append(' '); + this.result.append(' '); } ASTNode guardPredicate = getChildNode(node, RoleTypeDeclaration.GUARD_PROPERTY); if (guardPredicate != null) { guardPredicate.accept(this); this.result.append(' '); } - + this.result.append('{'); visitList(node, RoleTypeDeclaration.BODY_DECLARATIONS_PROPERTY, null); visitList(node, RoleTypeDeclaration.PRECEDENCE_PROPERTY, null); @@ -1738,7 +1738,7 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append(')'); return false; } - + @SuppressWarnings("nls") @Override public boolean visit(PrecedenceDeclaration node) { @@ -1754,5 +1754,5 @@ public class ASTRewriteFlattener extends ASTVisitor { this.result.append(';'); return false; } -// jsv+SH} +// jsv+SH} } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java index 356eb50b2..093813ad8 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java @@ -47,7 +47,7 @@ import org.eclipse.text.edits.TextEdit; public static class NodeMarker extends Position { public Object data; } - + private class ExtendedFlattener extends ASTRewriteFlattener { private ArrayList positions; @@ -56,7 +56,7 @@ import org.eclipse.text.edits.TextEdit; super(store); this.positions= new ArrayList(); } - + /* (non-Javadoc) * @see org.eclipse.jdt.core.dom.ASTVisitor#preVisit(ASTNode) */ @@ -84,7 +84,7 @@ import org.eclipse.text.edits.TextEdit; fixupLength(trackData, this.result.length()); } } - + /* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.dom.ASTRewriteFlattener#visit(org.eclipse.jdt.core.dom.Block) */ @@ -95,7 +95,7 @@ import org.eclipse.text.edits.TextEdit; } return super.visit(node); } - + private NodeMarker addMarker(Object annotation, int startOffset, int length) { NodeMarker marker= new NodeMarker(); marker.offset= startOffset; @@ -104,7 +104,7 @@ import org.eclipse.text.edits.TextEdit; this.positions.add(marker); return marker; } - + private void fixupLength(Object data, int endOffset) { for (int i= this.positions.size()-1; i >= 0 ; i--) { NodeMarker marker= (NodeMarker) this.positions.get(i); @@ -119,50 +119,50 @@ import org.eclipse.text.edits.TextEdit; return (NodeMarker[]) this.positions.toArray(new NodeMarker[this.positions.size()]); } } - + private final String lineDelimiter; private final int tabWidth; private final int indentWidth; - + private final NodeInfoStore placeholders; private final RewriteEventStore eventStore; private final Map options; - + public ASTRewriteFormatter(NodeInfoStore placeholders, RewriteEventStore eventStore, Map options, String lineDelimiter) { this.placeholders= placeholders; this.eventStore= eventStore; this.options= options; this.lineDelimiter= lineDelimiter; - + this.tabWidth= IndentManipulation.getTabWidth(options); this.indentWidth= IndentManipulation.getIndentWidth(options); } - - + + public NodeInfoStore getPlaceholders() { return this.placeholders; } - + public RewriteEventStore getEventStore() { return this.eventStore; } - + public int getTabWidth() { return this.tabWidth; } - + public int getIndentWidth() { return this.indentWidth; } - + public String getLineDelimiter() { return this.lineDelimiter; } - + /** * Returns the string accumulated in the visit formatted using the default formatter. * Updates the existing node's positions. @@ -171,17 +171,17 @@ import org.eclipse.text.edits.TextEdit; * @param initialIndentationLevel The initial indentation level. * @param resultingMarkers Resulting the updated NodeMarkers. * @return Returns the serialized and formatted code. - */ + */ public String getFormattedResult(ASTNode node, int initialIndentationLevel, Collection resultingMarkers) { - + ExtendedFlattener flattener= new ExtendedFlattener(this.eventStore); node.accept(flattener); NodeMarker[] markers= flattener.getMarkers(); for (int i= 0; i < markers.length; i++) { resultingMarkers.add(markers[i]); // add to result - } - + } + String unformatted= flattener.getResult(); TextEdit edit= formatNode(node, unformatted, initialIndentationLevel); if (edit == null) { @@ -198,23 +198,23 @@ import org.eclipse.text.edits.TextEdit; } return evaluateFormatterEdit(unformatted, edit, markers); } - + public String createIndentString(int indentationUnits) { return ToolFactory.createCodeFormatter(this.options).createIndentationString(indentationUnits); } - + public String getIndentString(String currentLine) { return IndentManipulation.extractIndentString(currentLine, this.tabWidth, this.indentWidth); } - + public String changeIndent(String code, int codeIndentLevel, String newIndent) { return IndentManipulation.changeIndent(code, codeIndentLevel, this.tabWidth, this.indentWidth, newIndent, this.lineDelimiter); } - + public int computeIndentUnits(String line) { return IndentManipulation.measureIndentUnits(line, this.tabWidth, this.indentWidth); } - + /** * Evaluates the edit on the given string. * @param string The string to format @@ -240,16 +240,16 @@ import org.eclipse.text.edits.TextEdit; } return null; } - + public TextEdit formatString(int kind, String string, int offset, int length, int indentationLevel) { return ToolFactory.createCodeFormatter(this.options).format(kind, string, offset, length, indentationLevel, this.lineDelimiter); } - + /** * Creates edits that describe how to format the given string. Returns <code>null</code> if the code could not be formatted for the given kind. * @param node Node describing the type of the string * @param str The unformatted string - * @param indentationLevel + * @param indentationLevel * @return Returns the edit representing the result of the formatter * @throws IllegalArgumentException If the offset and length are not inside the string, a * IllegalArgumentException is thrown. @@ -270,7 +270,7 @@ import org.eclipse.text.edits.TextEdit; code= CodeFormatter.K_STATEMENTS; } } else if (node instanceof Expression && node.getNodeType() != ASTNode.VARIABLE_DECLARATION_EXPRESSION) { -//{ObjectTeams: tells the formatter to format a single parameter mapping. It is not handled by the formatExpression method !! +//{ObjectTeams: tells the formatter to format a single parameter mapping. It is not handled by the formatExpression method !! if (node.getNodeType() == ASTNode.PARAMETER_MAPPING) { code = CodeFormatter.K_PARAMETER_MAPPING; } else @@ -310,7 +310,7 @@ import org.eclipse.text.edits.TextEdit; prefix= "A "; //$NON-NLS-1$ suffix= ";"; //$NON-NLS-1$ code= CodeFormatter.K_STATEMENTS; - break; + break; case ASTNode.PACKAGE_DECLARATION: case ASTNode.IMPORT_DECLARATION: suffix= "\nclass A {}"; //$NON-NLS-1$ @@ -336,7 +336,7 @@ import org.eclipse.text.edits.TextEdit; break; case ASTNode.MODIFIER: suffix= " class x {}"; //$NON-NLS-1$ - code= CodeFormatter.K_COMPILATION_UNIT; + code= CodeFormatter.K_COMPILATION_UNIT; break; case ASTNode.TYPE_PARAMETER: prefix= "class X<"; //$NON-NLS-1$ @@ -349,9 +349,9 @@ import org.eclipse.text.edits.TextEdit; case ASTNode.TAG_ELEMENT: case ASTNode.TEXT_ELEMENT: // javadoc formatting disabled due to bug 93644 - return null; + return null; -// wiat for bug 93644 +// wiat for bug 93644 // case ASTNode.MEMBER_REF: // case ASTNode.METHOD_REF: // prefix= "/**\n * @see "; @@ -374,20 +374,20 @@ import org.eclipse.text.edits.TextEdit; return null; } } - + String concatStr= prefix + str + suffix; TextEdit edit= formatString(code, concatStr, prefix.length(), str.length(), indentationLevel); - + if (prefix.length() > 0) { edit= shifEdit(edit, prefix.length()); - } + } return edit; } - + //{ObjectTeams: needed to configure the scanner: private boolean isOTJCode(ASTNode node) { while (node != null && node.getNodeType() != ASTNode.TYPE_DECLARATION) { - switch (node.getNodeType()) { + switch (node.getNodeType()) { case ASTNode.ROLE_TYPE_DECLARATION: case ASTNode.CALLOUT_MAPPING_DECLARATION: case ASTNode.CALLIN_MAPPING_DECLARATION: @@ -419,7 +419,7 @@ import org.eclipse.text.edits.TextEdit; DeleteEdit edit= (DeleteEdit) oldEdit; newEdit= new DeleteEdit(edit.getOffset() - diff, edit.getLength()); } else if (oldEdit instanceof MultiTextEdit) { - newEdit= new MultiTextEdit(); + newEdit= new MultiTextEdit(); } else { return null; // not supported } @@ -432,13 +432,13 @@ import org.eclipse.text.edits.TextEdit; } return newEdit; } - + private static Document createDocument(String string, Position[] positions) throws IllegalArgumentException { Document doc= new Document(string); try { if (positions != null) { final String POS_CATEGORY= "myCategory"; //$NON-NLS-1$ - + doc.addPositionCategory(POS_CATEGORY); doc.addPositionUpdater(new DefaultPositionUpdater(POS_CATEGORY) { protected boolean notDeleted() { @@ -465,41 +465,41 @@ import org.eclipse.text.edits.TextEdit; return doc; } - + public static interface Prefix { String getPrefix(int indent); } - + public static interface BlockContext { String[] getPrefixAndSuffix(int indent, ASTNode node, RewriteEventStore events); - } - + } + public static class ConstPrefix implements Prefix { private String prefix; - + public ConstPrefix(String prefix) { this.prefix= prefix; } - + public String getPrefix(int indent) { return this.prefix; } } - + private class FormattingPrefix implements Prefix { private int kind; private String string; private int start; private int length; - + public FormattingPrefix(String string, String sub, int kind) { this.start= string.indexOf(sub); this.length= sub.length(); this.string= string; this.kind= kind; } - + public String getPrefix(int indent) { Position pos= new Position(this.start, this.length); String str= this.string; @@ -514,12 +514,12 @@ import org.eclipse.text.edits.TextEdit; private class BlockFormattingPrefix implements BlockContext { private String prefix; private int start; - + public BlockFormattingPrefix(String prefix, int start) { this.start= start; this.prefix= prefix; } - + public String[] getPrefixAndSuffix(int indent, ASTNode node, RewriteEventStore events) { String nodeString= ASTRewriteFlattener.asString(node, events); String str= this.prefix + nodeString; @@ -532,25 +532,25 @@ import org.eclipse.text.edits.TextEdit; return new String[] { str.substring(pos.offset + 1, pos.offset + pos.length - 1), ""}; //$NON-NLS-1$ } } - + private class BlockFormattingPrefixSuffix implements BlockContext { private String prefix; private String suffix; private int start; - + public BlockFormattingPrefixSuffix(String prefix, String suffix, int start) { this.start= start; this.suffix= suffix; this.prefix= prefix; } - + public String[] getPrefixAndSuffix(int indent, ASTNode node, RewriteEventStore events) { String nodeString= ASTRewriteFlattener.asString(node, events); int nodeStart= this.prefix.length(); int nodeEnd= nodeStart + nodeString.length() - 1; - + String str= this.prefix + nodeString + this.suffix; - + Position pos1= new Position(this.start, nodeStart + 1 - this.start); Position pos2= new Position(nodeEnd, 2); @@ -563,12 +563,12 @@ import org.eclipse.text.edits.TextEdit; str.substring(pos2.offset + 1, pos2.offset + pos2.length - 1) }; } - } - + } + public final static Prefix NONE= new ConstPrefix(""); //$NON-NLS-1$ public final static Prefix SPACE= new ConstPrefix(" "); //$NON-NLS-1$ public final static Prefix ASSERT_COMMENT= new ConstPrefix(" : "); //$NON-NLS-1$ - + public final Prefix VAR_INITIALIZER= new FormattingPrefix("A a={};", "a={" , CodeFormatter.K_STATEMENTS); //$NON-NLS-1$ //$NON-NLS-2$ public final Prefix METHOD_BODY= new FormattingPrefix("void a() {}", ") {" , CodeFormatter.K_CLASS_BODY_DECLARATIONS); //$NON-NLS-1$ //$NON-NLS-2$ public final Prefix FINALLY_BLOCK= new FormattingPrefix("try {} finally {}", "} finally {", CodeFormatter.K_STATEMENTS); //$NON-NLS-1$ //$NON-NLS-2$ @@ -582,7 +582,7 @@ import org.eclipse.text.edits.TextEdit; public final Prefix FIRST_ENUM_CONST= new FormattingPrefix("enum E { X;}", "{ X" , CodeFormatter.K_COMPILATION_UNIT); //$NON-NLS-1$ //$NON-NLS-2$ public final Prefix ANNOTATION_SEPARATION= new FormattingPrefix("@A @B class C {}", "A @" , CodeFormatter.K_COMPILATION_UNIT); //$NON-NLS-1$ //$NON-NLS-2$ public final Prefix PARAM_ANNOTATION_SEPARATION= new FormattingPrefix("void foo(@A @B p) { }", "A @" , CodeFormatter.K_CLASS_BODY_DECLARATIONS); //$NON-NLS-1$ //$NON-NLS-2$ - + public final BlockContext IF_BLOCK_WITH_ELSE= new BlockFormattingPrefixSuffix("if (true)", "else{}", 8); //$NON-NLS-1$ //$NON-NLS-2$ public final BlockContext IF_BLOCK_NO_ELSE= new BlockFormattingPrefix("if (true)", 8); //$NON-NLS-1$ public final BlockContext ELSE_AFTER_STATEMENT= new BlockFormattingPrefix("if (true) foo();else ", 15); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java index e83770e3e..2c5d21e16 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java @@ -117,7 +117,7 @@ public final class ImportRewriteAnalyzer { } return 1; } - + private boolean insertSpaceBeforeSemicolon() { return JavaCore.INSERT.equals(this.compilationUnit.getJavaProject().getOption(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, true)); } @@ -228,7 +228,7 @@ public final class ImportRewriteAnalyzer { return testedName; } } - } while (index >= 0); + } while (index >= 0); return name; } @@ -325,10 +325,10 @@ public final class ImportRewriteAnalyzer { * Note: {@link #ImportRewriteAnalyzer(ICompilationUnit, CompilationUnit, String[], int, int, boolean, boolean)} with true as the last * parameter can be used to filter implicit imports when a context is used. * </p> - * + * * @param filterImplicitImports * if <code>true</code>, implicit imports will be filtered - * + * * @see #ImportRewriteAnalyzer(ICompilationUnit, CompilationUnit, String[], int, int, boolean, boolean) */ public void setFilterImplicitImports(boolean filterImplicitImports) { @@ -430,7 +430,7 @@ public final class ImportRewriteAnalyzer { return 0; } -//{ObjectTeams: added: 'isBase': +//{ObjectTeams: added: 'isBase': private PackageEntry findBestMatch(String newName, boolean isStatic, boolean isBase) { // SH} if (this.packageEntries.isEmpty()) { @@ -465,7 +465,7 @@ public final class ImportRewriteAnalyzer { matcher.initialize(newName, ""); //$NON-NLS-1$ for (int i= 0; i < this.packageEntries.size(); i++) { // find the best match with the same group PackageEntry curr= (PackageEntry) this.packageEntries.get(i); - if (!curr.isComment() && curr.isStatic() == isStatic + if (!curr.isComment() && curr.isStatic() == isStatic //{ObjectTeams: new check: && isBase == curr.isBase()) { @@ -530,7 +530,7 @@ public final class ImportRewriteAnalyzer { } return false; } - + //{ObjectTeams: base import: public void addBaseImport(String fullTypeName) { String typeContainerName= Signature.getQualifier(fullTypeName); @@ -562,7 +562,7 @@ public final class ImportRewriteAnalyzer { } return this.packageEntries.size(); } - + //{ObjectTeams: /* orig: private void sortIn(String typeContainerName, ImportDeclEntry decl, boolean isStatic) { @@ -573,14 +573,14 @@ public final class ImportRewriteAnalyzer { // SH} if (bestMatch == null) { //{ObjectTeams: isBase: -/* orig: +/* orig: PackageEntry packEntry= new PackageEntry(typeContainerName, null, isStatic); :giro */ PackageEntry packEntry= new PackageEntry(typeContainerName, null, isStatic, isBase); // SH} packEntry.add(decl); int insertPos= packEntry.isStatic() ? 0 : getIndexAfterStatics(); -//{ObjectTeams: +//{ObjectTeams: if (isBase) insertPos = getIndexAfterRegular(); // SH} this.packageEntries.add(insertPos, packEntry); @@ -597,7 +597,7 @@ public final class ImportRewriteAnalyzer { } } //{ObjectTeams: isBase: -/* orig: +/* orig: PackageEntry packEntry= new PackageEntry(typeContainerName, group, isStatic); :giro */ PackageEntry packEntry= new PackageEntry(typeContainerName, group, isStatic, isBase); @@ -614,7 +614,7 @@ public final class ImportRewriteAnalyzer { } } } -//{ObjectTeams: similar to getIndexAfterStatics: +//{ObjectTeams: similar to getIndexAfterStatics: private int getIndexAfterRegular() { for (int i= 0; i < this.packageEntries.size(); i++) { if (((PackageEntry) this.packageEntries.get(i)).isBase()) { @@ -896,7 +896,7 @@ public final class ImportRewriteAnalyzer { return onDemandConflicts; } -//{ObjectTeams: added 3. parameter +//{ObjectTeams: added 3. parameter private String getNewImportString(String importName, boolean isStatic, boolean isBase, String lineDelim) { // SH} StringBuffer buf= new StringBuffer(); @@ -920,7 +920,7 @@ public final class ImportRewriteAnalyzer { } return buf.toString(); } - + private String[] getNewImportStrings(PackageEntry packageEntry, boolean isStatic, String lineDelim) { boolean isStarImportAdded = false; List allImports = new ArrayList(); @@ -1030,7 +1030,7 @@ public final class ImportRewriteAnalyzer { public String getTypeQualifiedName() { return this.elementName.substring(this.containerNameLength + 1); } - + public boolean isOnDemand() { return this.elementName != null && this.elementName.endsWith(".*"); //$NON-NLS-1$ } @@ -1110,8 +1110,8 @@ public final class ImportRewriteAnalyzer { //{ObjectTeams: also compare base flag: /* orig: public int compareTo(String otherName, boolean isOtherStatic) { - :giro */ - public int compareTo(String otherName, boolean isOtherStatic, boolean isOtherBase) + :giro */ + public int compareTo(String otherName, boolean isOtherStatic, boolean isOtherBase) { // SH} int cmp= this.name.compareTo(otherName); diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineCommentEndOffsets.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineCommentEndOffsets.java index 772fa6aad..026b1cfb1 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineCommentEndOffsets.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineCommentEndOffsets.java @@ -19,15 +19,15 @@ import org.eclipse.jdt.core.formatter.IndentManipulation; import org.eclipse.jdt.internal.compiler.util.Util; public class LineCommentEndOffsets { - + private int[] offsets; private final List commentList; - + public LineCommentEndOffsets(List commentList) { this.commentList= commentList; this.offsets= null; // create on demand } - + private int[] getOffsets() { if (this.offsets == null) { if (this.commentList != null) { @@ -55,18 +55,18 @@ public class LineCommentEndOffsets { } return this.offsets; } - + public boolean isEndOfLineComment(int offset) { return offset >= 0 && Arrays.binarySearch(getOffsets(), offset) >= 0; } - + public boolean isEndOfLineComment(int offset, char[] content) { if (offset < 0 || (offset < content.length && !IndentManipulation.isLineDelimiterChar(content[offset]))) { return false; } return Arrays.binarySearch(getOffsets(), offset) >= 0; } - + public boolean remove(int offset) { int[] offsetArray= getOffsets(); // returns the shared array int index= Arrays.binarySearch(offsetArray, offset); @@ -81,5 +81,5 @@ public class LineCommentEndOffsets { } return false; } - + } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java index fca9ea5e0..200db80f0 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java @@ -16,10 +16,10 @@ import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; /** - * + * */ public abstract class LineInformation { - + public static LineInformation create(final IDocument doc) { return new LineInformation() { public int getLineOfOffset(int offset) { @@ -39,7 +39,7 @@ public abstract class LineInformation { } }; } - + public static LineInformation create(final CompilationUnit astRoot) { return new LineInformation() { public int getLineOfOffset(int offset) { @@ -50,10 +50,10 @@ public abstract class LineInformation { } }; } - - - + + + public abstract int getLineOfOffset(int offset); public abstract int getLineOffset(int line); - + } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java index e32af7fee..7ba9a3336 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java @@ -19,21 +19,21 @@ import org.eclipse.jdt.core.dom.ASTNode; * */ public class ListRewriteEvent extends RewriteEvent { - + public final static int NEW= 1; public final static int OLD= 2; public final static int BOTH= NEW | OLD; - + /** original list of 'ASTNode' */ private List originalNodes; /** list of type 'RewriteEvent' */ private List listEntries; - + /** * Creates a ListRewriteEvent from the original ASTNodes. The resulting event * represents the unmodified list. - * @param originalNodes The original nodes (type ASTNode) + * @param originalNodes The original nodes (type ASTNode) */ public ListRewriteEvent(List originalNodes) { this.originalNodes= new ArrayList(originalNodes); @@ -54,7 +54,7 @@ public class ListRewriteEvent extends RewriteEvent { } } } - + private List getEntries() { if (this.listEntries == null) { // create if not yet existing @@ -68,7 +68,7 @@ public class ListRewriteEvent extends RewriteEvent { } return this.listEntries; } - + /* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.dom.ASTRewriteChange#getChangeKind() */ @@ -90,7 +90,7 @@ public class ListRewriteEvent extends RewriteEvent { public boolean isListRewrite() { return true; } - + /* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.dom.RewriteEvent#getChildren() */ @@ -120,19 +120,19 @@ public class ListRewriteEvent extends RewriteEvent { } } return res; - } - + } + // API to modify the list nodes - + public RewriteEvent removeEntry(ASTNode originalEntry) { return replaceEntry(originalEntry, null); } - + public RewriteEvent replaceEntry(ASTNode entry, ASTNode newEntry) { if (entry == null) { throw new IllegalArgumentException(); } - + List entries= getEntries(); int nEntries= entries.size(); for (int i= 0; i < nEntries; i++) { @@ -148,7 +148,7 @@ public class ListRewriteEvent extends RewriteEvent { } return null; } - + public void revertChange(NodeRewriteEvent event) { Object originalValue = event.getOriginalValue(); if (originalValue == null) { @@ -158,7 +158,7 @@ public class ListRewriteEvent extends RewriteEvent { event.setNewValue(originalValue); } } - + public int getIndex(ASTNode node, int kind) { List entries= getEntries(); for (int i= entries.size() - 1; i >= 0; i--) { @@ -172,7 +172,7 @@ public class ListRewriteEvent extends RewriteEvent { } return -1; } - + public RewriteEvent insert(ASTNode insertedNode, int insertIndex) { NodeRewriteEvent change= new NodeRewriteEvent(null, insertedNode); if (insertIndex != -1) { @@ -182,23 +182,23 @@ public class ListRewriteEvent extends RewriteEvent { } return change; } - + public void setNewValue(ASTNode newValue, int insertIndex) { NodeRewriteEvent curr= (NodeRewriteEvent) getEntries().get(insertIndex); curr.setNewValue(newValue); } - + public int getChangeKind(int index) { return ((NodeRewriteEvent) getEntries().get(index)).getChangeKind(); } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { StringBuffer buf= new StringBuffer(); buf.append(" [list change\n\t"); //$NON-NLS-1$ - + RewriteEvent[] events= getChildren(); for (int i= 0; i < events.length; i++) { if (i != 0) { @@ -211,5 +211,5 @@ public class ListRewriteEvent extends RewriteEvent { } - + } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java index 6c03454cb..a1f18cd51 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java @@ -30,9 +30,9 @@ import org.eclipse.jdt.internal.core.dom.rewrite.RewriteEventStore.CopySourceInf /** * */ -public final class NodeInfoStore { +public final class NodeInfoStore { private AST ast; - + private Map placeholderNodes; private Set collapsedNodes; @@ -54,7 +54,7 @@ public final class NodeInfoStore { data.code= code; setPlaceholderData(placeholder, data); } - + /** * Marks a node as a copy or move target. The copy target represents a copied node at the target (copied) site. * @param target The node at the target site. Can be a placeholder node but also the source node itself. @@ -65,7 +65,7 @@ public final class NodeInfoStore { data.copySource= copySource; setPlaceholderData(target, data); } - + /** * Creates a placeholder node of the given type. <code>null</code> if the type is not supported * @param nodeType Type of the node to create. Use the type constants in {@link NodeInfoStore}. @@ -99,12 +99,12 @@ public final class NodeInfoStore { return null; } } - - + + // collapsed nodes: in source: use one node that represents many; to be used as // copy/move source or to replace at once. // in the target: one block node that is not flattened. - + public Block createCollapsePlaceholder() { Block placeHolder= this.ast.newBlock(); if (this.collapsedNodes == null) { @@ -113,39 +113,39 @@ public final class NodeInfoStore { this.collapsedNodes.add(placeHolder); return placeHolder; } - + public boolean isCollapsed(ASTNode node) { if (this.collapsedNodes != null) { return this.collapsedNodes.contains(node); } - return false; + return false; } - + public Object getPlaceholderData(ASTNode node) { if (this.placeholderNodes != null) { return this.placeholderNodes.get(node); } - return null; + return null; } - + private void setPlaceholderData(ASTNode node, PlaceholderData data) { if (this.placeholderNodes == null) { this.placeholderNodes= new IdentityHashMap(); } - this.placeholderNodes.put(node, data); + this.placeholderNodes.put(node, data); } - + static class PlaceholderData { // base class } - + protected static final class CopyPlaceholderData extends PlaceholderData { public CopySourceInfo copySource; public String toString() { return "[placeholder " + this.copySource +"]"; //$NON-NLS-1$//$NON-NLS-2$ } - } - + } + protected static final class StringPlaceholderData extends PlaceholderData { public String code; public String toString() { @@ -154,7 +154,7 @@ public final class NodeInfoStore { } /** - * + * */ public void clear() { this.placeholderNodes= null; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java index cb063ebb7..42b13ce76 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java @@ -16,29 +16,29 @@ package org.eclipse.jdt.internal.core.dom.rewrite; * */ public class NodeRewriteEvent extends RewriteEvent { - + private Object originalValue; private Object newValue; - + public NodeRewriteEvent(Object originalValue, Object newValue) { this.originalValue= originalValue; this.newValue= newValue; } - + /** * @return Returns the new value. */ public Object getNewValue() { return this.newValue; } - + /** * @return Returns the original value. */ public Object getOriginalValue() { return this.originalValue; } - + /* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.dom.RewriteEvent#getChangeKind() */ @@ -57,7 +57,7 @@ public class NodeRewriteEvent extends RewriteEvent { } return REPLACED; } - + /* (non-Javadoc) * @see org.eclipse.jdt.internal.corext.dom.RewriteEvent#isListRewrite() @@ -80,7 +80,7 @@ public class NodeRewriteEvent extends RewriteEvent { public RewriteEvent[] getChildren() { return null; } - + /* (non-Javadoc) * @see java.lang.Object#toString() */ @@ -109,6 +109,6 @@ public class NodeRewriteEvent extends RewriteEvent { } return buf.toString(); } - + } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java index e957b360b..20dc32a1a 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java @@ -15,25 +15,25 @@ package org.eclipse.jdt.internal.core.dom.rewrite; * */ public abstract class RewriteEvent { - + /** * Change kind to describe that the event is an insert event. * Does not apply for list events. */ public static final int INSERTED= 1; - + /** * Change kind to describe that the event is an remove event. * Does not apply for list events. */ public static final int REMOVED= 2; - + /** * Change kind to describe that the event is an replace event. * Does not apply for list events. */ public static final int REPLACED= 4; - + /** * Change kind to signal that children changed. Does only apply for list events. */ @@ -43,23 +43,23 @@ public abstract class RewriteEvent { * Change kind to signal that the property did not change */ public static final int UNCHANGED= 0; - + /** * @return Returns the event's change kind. */ public abstract int getChangeKind(); - + /** * @return Returns true if the given event is a list event. */ public abstract boolean isListRewrite(); - + /** * @return Returns the original value. For lists this is a <code>List<code> of ASTNode's, for non-list * events this can be an ASTNode (for node properties), Integer (for an integer property), * Boolean (for boolean node properties) or properties like Operator. * <code>null</code> is returned if the event is a insert event. - */ + */ public abstract Object getOriginalValue(); /** @@ -67,13 +67,13 @@ public abstract class RewriteEvent { * events this can be an ASTNode (for node properties), Integer (for an integer property), * Boolean (for boolean node properties) or properties like Operator. * <code>null</code> is returned if the event is a remove event. - */ + */ public abstract Object getNewValue(); - + /** * @return Return the events describing the changes in a list. returns <code>null</code> if the * event is not a list event. */ public abstract RewriteEvent[] getChildren(); - + } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java index 7b0d5974d..018dc88e3 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java @@ -25,12 +25,12 @@ import org.eclipse.text.edits.TextEditGroup; * are copy or move sources or tracked. */ public final class RewriteEventStore { - + public static final class PropertyLocation { private final ASTNode parent; private final StructuralPropertyDescriptor property; - + public PropertyLocation(ASTNode parent, StructuralPropertyDescriptor property) { this.parent= parent; this.property= property; @@ -43,7 +43,7 @@ public final class RewriteEventStore { public StructuralPropertyDescriptor getProperty() { return this.property; } - + public boolean equals(Object obj) { if (obj != null && obj.getClass().equals(getClass())) { PropertyLocation other= (PropertyLocation) obj; @@ -51,13 +51,13 @@ public final class RewriteEventStore { } return false; } - + public int hashCode() { return getParent().hashCode() + getProperty().hashCode(); } - + } - + /** * Interface that allows to override the way how children are accessed from * a parent. Use this interface when the rewriter is set up on an already @@ -65,14 +65,14 @@ public final class RewriteEventStore { */ public static interface INodePropertyMapper { /** - * Returns the node attribute for a given property name. + * Returns the node attribute for a given property name. * @param parent The parent node - * @param childProperty The child property to access + * @param childProperty The child property to access * @return The child node at the given property location. */ Object getOriginalValue(ASTNode parent, StructuralPropertyDescriptor childProperty); } - + /* * Store element to associate event and node position/ */ @@ -80,13 +80,13 @@ public final class RewriteEventStore { public final ASTNode parent; public final StructuralPropertyDescriptor childProperty; public final RewriteEvent event; - + public EventHolder(ASTNode parent, StructuralPropertyDescriptor childProperty, RewriteEvent change) { this.parent= parent; this.childProperty= childProperty; this.event= change; } - + public String toString() { StringBuffer buf= new StringBuffer(); buf.append(this.parent).append(" - "); //$NON-NLS-1$ @@ -95,25 +95,25 @@ public final class RewriteEventStore { return buf.toString(); } } - + public static class CopySourceInfo implements Comparable { public final PropertyLocation location; // can be null, only used to mark as removed on move private final ASTNode node; public final boolean isMove; - + public CopySourceInfo(PropertyLocation location, ASTNode node, boolean isMove) { this.location= location; this.node= node; this.isMove= isMove; } - + public ASTNode getNode() { return this.node; } - + public int compareTo(Object o2) { CopySourceInfo r2= (CopySourceInfo) o2; - + int startDiff= getNode().getStartPosition() - r2.getNode().getStartPosition(); if (startDiff != 0) { return startDiff; // insert before if start node is first @@ -124,7 +124,7 @@ public final class RewriteEventStore { } return 0; } - + public String toString() { StringBuffer buf= new StringBuffer(); if (this.isMove) { @@ -136,14 +136,14 @@ public final class RewriteEventStore { return buf.toString(); } } - + private static class NodeRangeInfo implements Comparable { private final ASTNode first; private final ASTNode last; public final CopySourceInfo copyInfo; // containing the internal placeholder and the 'isMove' flag public final ASTNode replacingNode; public final TextEditGroup editGroup; - + public NodeRangeInfo(ASTNode parent, StructuralPropertyDescriptor childProperty, ASTNode first, ASTNode last, CopySourceInfo copyInfo, ASTNode replacingNode, TextEditGroup editGroup) { this.first= first; this.last= last; @@ -151,26 +151,26 @@ public final class RewriteEventStore { this.replacingNode= replacingNode; this.editGroup= editGroup; } - + public ASTNode getStartNode() { return this.first; } - + public ASTNode getEndNode() { return this.last; } - + public boolean isMove() { return this.copyInfo.isMove; } - + public Block getInternalPlaceholder() { return (Block) this.copyInfo.getNode(); } - + public int compareTo(Object o2) { NodeRangeInfo r2= (NodeRangeInfo) o2; - + int startDiff= getStartNode().getStartPosition() - r2.getStartNode().getStartPosition(); if (startDiff != 0) { return startDiff; // insert before if start node is first @@ -184,17 +184,17 @@ public final class RewriteEventStore { } return 0; } - + public void updatePlaceholderSourceRanges(TargetSourceRangeComputer sourceRangeComputer) { TargetSourceRangeComputer.SourceRange startRange= sourceRangeComputer.computeSourceRange(getStartNode()); TargetSourceRangeComputer.SourceRange endRange= sourceRangeComputer.computeSourceRange(getEndNode()); int startPos= startRange.getStartPosition(); int endPos= endRange.getStartPosition() + endRange.getLength(); - + Block internalPlaceholder= getInternalPlaceholder(); internalPlaceholder.setSourceRange(startPos, endPos - startPos); } - + public String toString() { StringBuffer buf= new StringBuffer(); if (this.first != this.last) { @@ -213,17 +213,17 @@ public final class RewriteEventStore { } - + /** - * Iterates over all event parent nodes, tracked nodes and all copy/move sources + * Iterates over all event parent nodes, tracked nodes and all copy/move sources */ private class ParentIterator implements Iterator { - + private Iterator eventIter; private Iterator sourceNodeIter; private Iterator rangeNodeIter; private Iterator trackedNodeIter; - + public ParentIterator() { this.eventIter= RewriteEventStore.this.eventLookup.keySet().iterator(); if (RewriteEventStore.this.nodeCopySources != null) { @@ -273,53 +273,53 @@ public final class RewriteEventStore { throw new UnsupportedOperationException(); } } - + public final static int NEW= 1; public final static int ORIGINAL= 2; public final static int BOTH= NEW | ORIGINAL; - - + + /** all events by parent*/ final Map eventLookup; - + /** cache for last accessed event */ private EventHolder lastEvent; - + /** Maps events to group descriptions */ private Map editGroups; - + /** Stores which nodes are source of a copy or move (list of CopySourceInfo)*/ List nodeCopySources; - + /** Stores node ranges that are used to copy or move (map of <PropertyLocation, CopyRangeInfo>)*/ Map nodeRangeInfos; - + /** Stores which nodes are tracked and the corresponding edit group*/ Map trackedNodes; - + /** Stores which inserted nodes bound to the previous node. If not, a node is * always bound to the next node */ private Set insertBoundToPrevious; - + /** optional mapper to allow fix already modified AST trees */ private INodePropertyMapper nodePropertyMapper; - + private static final String INTERNAL_PLACEHOLDER_PROPERTY= "rewrite_internal_placeholder"; //$NON-NLS-1$ - + public RewriteEventStore() { this.eventLookup= new HashMap(); this.lastEvent= null; - + this.editGroups= null; // lazy initialization - + this.trackedNodes= null; this.insertBoundToPrevious= null; - + this.nodePropertyMapper= null; this.nodeCopySources= null; this.nodeRangeInfos= null; } - + /** * Override the default way how to access children from a parent node. * @param nodePropertyMapper The new <code>INodePropertyMapper</code> or @@ -328,26 +328,26 @@ public final class RewriteEventStore { public void setNodePropertyMapper(INodePropertyMapper nodePropertyMapper) { this.nodePropertyMapper= nodePropertyMapper; } - + public void clear() { this.eventLookup.clear(); this.lastEvent= null; this.trackedNodes= null; - + this.editGroups= null; // lazy initialization this.insertBoundToPrevious= null; this.nodeCopySources= null; } - + public void addEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, RewriteEvent event) { validateHasChildProperty(parent, childProperty); - + if (event.isListRewrite()) { validateIsListProperty(childProperty); } - + EventHolder holder= new EventHolder(parent, childProperty, event); - + List entriesList = (List) this.eventLookup.get(parent); if (entriesList != null) { for (int i= 0; i < entriesList.size(); i++) { @@ -364,14 +364,14 @@ public final class RewriteEventStore { } entriesList.add(holder); } - + public RewriteEvent getEvent(ASTNode parent, StructuralPropertyDescriptor property) { validateHasChildProperty(parent, property); - + if (this.lastEvent != null && this.lastEvent.parent == parent && this.lastEvent.childProperty == property) { return this.lastEvent.event; } - + List entriesList = (List) this.eventLookup.get(parent); if (entriesList != null) { for (int i= 0; i < entriesList.size(); i++) { @@ -384,7 +384,7 @@ public final class RewriteEventStore { } return null; } - + public NodeRewriteEvent getNodeEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation) { validateIsNodeProperty(childProperty); NodeRewriteEvent event= (NodeRewriteEvent) getEvent(parent, childProperty); @@ -393,9 +393,9 @@ public final class RewriteEventStore { event= new NodeRewriteEvent(originalValue, originalValue); addEvent(parent, childProperty, event); } - return event; + return event; } - + public ListRewriteEvent getListEvent(ASTNode parent, StructuralPropertyDescriptor childProperty, boolean forceCreation) { validateIsListProperty(childProperty); ListRewriteEvent event= (ListRewriteEvent) getEvent(parent, childProperty); @@ -406,12 +406,12 @@ public final class RewriteEventStore { } return event; } - + public Iterator getChangeRootIterator() { return new ParentIterator(); } - - + + public boolean hasChangedProperties(ASTNode parent) { List entriesList = (List) this.eventLookup.get(parent); if (entriesList != null) { @@ -424,7 +424,7 @@ public final class RewriteEventStore { } return false; } - + public PropertyLocation getPropertyLocation(Object value, int kind) { for (Iterator iter= this.eventLookup.values().iterator(); iter.hasNext();) { List events= (List) iter.next(); @@ -446,12 +446,12 @@ public final class RewriteEventStore { } if (value instanceof ASTNode) { ASTNode node= (ASTNode) value; - return new PropertyLocation(node.getParent(), node.getLocationInParent()); + return new PropertyLocation(node.getParent(), node.getLocationInParent()); } return null; } - - + + /** * Kind is either ORIGINAL, NEW, or BOTH * @param value @@ -478,7 +478,7 @@ public final class RewriteEventStore { } return null; } - + private boolean isNodeInEvent(RewriteEvent event, Object value, int kind) { if (((kind & NEW) != 0) && event.getNewValue() == value) { return true; @@ -488,8 +488,8 @@ public final class RewriteEventStore { } return false; } - - + + public Object getOriginalValue(ASTNode parent, StructuralPropertyDescriptor property) { RewriteEvent event= getEvent(parent, property); if (event != null) { @@ -497,7 +497,7 @@ public final class RewriteEventStore { } return accessOriginalValue(parent, property); } - + public Object getNewValue(ASTNode parent, StructuralPropertyDescriptor property) { RewriteEvent event= getEvent(parent, property); if (event != null) { @@ -505,10 +505,10 @@ public final class RewriteEventStore { } return accessOriginalValue(parent, property); } - + public List getChangedPropertieEvents(ASTNode parent) { List changedPropertiesEvent = new ArrayList(); - + List entriesList = (List) this.eventLookup.get(parent); if (entriesList != null) { for (int i= 0; i < entriesList.size(); i++) { @@ -528,7 +528,7 @@ public final class RewriteEventStore { } return RewriteEvent.UNCHANGED; } - + /* * Gets an original child from the AST. * Temporarily overridden to port the old rewriter to the new infrastructure. @@ -537,39 +537,39 @@ public final class RewriteEventStore { if (this.nodePropertyMapper != null) { return this.nodePropertyMapper.getOriginalValue(parent, childProperty); } - + return parent.getStructuralProperty(childProperty); - } - + } + public TextEditGroup getEventEditGroup(RewriteEvent event) { if (this.editGroups == null) { return null; } return (TextEditGroup) this.editGroups.get(event); } - + public void setEventEditGroup(RewriteEvent event, TextEditGroup editGroup) { if (this.editGroups == null) { this.editGroups= new IdentityHashMap(5); - } + } this.editGroups.put(event, editGroup); } - - + + public final TextEditGroup getTrackedNodeData(ASTNode node) { if (this.trackedNodes != null) { return (TextEditGroup) this.trackedNodes.get(node); } - return null; + return null; } - + public void setTrackedNodeData(ASTNode node, TextEditGroup editGroup) { if (this.trackedNodes == null) { this.trackedNodes= new IdentityHashMap(); } this.trackedNodes.put(node, editGroup); } - + /** * Marks a node as tracked. The edits added to the group editGroup can be used to get the * position of the node after the rewrite operation. @@ -581,34 +581,34 @@ public final class RewriteEventStore { throw new IllegalArgumentException("Node is already marked as tracked"); //$NON-NLS-1$ } setTrackedNodeData(node, editGroup); - } - + } + private final CopySourceInfo createCopySourceInfo(PropertyLocation location, ASTNode node, boolean isMove) { CopySourceInfo copySource= new CopySourceInfo(location, node, isMove); - + if (this.nodeCopySources == null) { this.nodeCopySources= new ArrayList(); } this.nodeCopySources.add(copySource); return copySource; } - + public final CopySourceInfo markAsCopySource(ASTNode parent, StructuralPropertyDescriptor property, ASTNode node, boolean isMove) { return createCopySourceInfo(new PropertyLocation(parent, property), node, isMove); } - + public final boolean isRangeCopyPlaceholder(ASTNode node) { return node.getProperty(INTERNAL_PLACEHOLDER_PROPERTY) != null; } - + public final CopySourceInfo createRangeCopy(ASTNode parent, StructuralPropertyDescriptor childProperty, ASTNode first, ASTNode last, boolean isMove, ASTNode internalPlaceholder, ASTNode replacingNode, TextEditGroup editGroup) { CopySourceInfo copyInfo= createCopySourceInfo(null, internalPlaceholder, isMove); internalPlaceholder.setProperty(INTERNAL_PLACEHOLDER_PROPERTY, internalPlaceholder); - + NodeRangeInfo copyRangeInfo= new NodeRangeInfo(parent, childProperty, first, last, copyInfo, replacingNode, editGroup); - + ListRewriteEvent listEvent= getListEvent(parent, childProperty, true); - + int indexFirst= listEvent.getIndex(first, ListRewriteEvent.OLD); if (indexFirst == -1) { throw new IllegalArgumentException("Start node is not a original child of the given list"); //$NON-NLS-1$ @@ -621,7 +621,7 @@ public final class RewriteEventStore { if (indexFirst > indexLast) { throw new IllegalArgumentException("Start node must be before end node"); //$NON-NLS-1$ } - + if (this.nodeRangeInfos == null) { this.nodeRangeInfos= new HashMap(); } @@ -634,19 +634,19 @@ public final class RewriteEventStore { assertNoOverlap(listEvent, indexFirst, indexLast, innerList); } innerList.add(copyRangeInfo); - - + + return copyInfo; } - + public CopySourceInfo[] getNodeCopySources(ASTNode node) { if (this.nodeCopySources == null) { return null; } return internalGetCopySources(this.nodeCopySources, node); } - - + + public CopySourceInfo[] internalGetCopySources(List copySources, ASTNode node) { ArrayList res= new ArrayList(3); for (int i= 0; i < copySources.size(); i++) { @@ -658,13 +658,13 @@ public final class RewriteEventStore { if (res.isEmpty()) { return null; } - + CopySourceInfo[] arr= (CopySourceInfo[]) res.toArray(new CopySourceInfo[res.size()]); Arrays.sort(arr); return arr; } - - + + private void assertNoOverlap(ListRewriteEvent listEvent, int indexFirst, int indexLast, List innerList) { for (Iterator iter= innerList.iterator(); iter.hasNext();) { NodeRangeInfo curr= (NodeRangeInfo) iter.next(); @@ -672,27 +672,27 @@ public final class RewriteEventStore { int currEnd= listEvent.getIndex(curr.getEndNode(), ListRewriteEvent.BOTH); if (currStart < indexFirst && currEnd < indexLast && currEnd >= indexFirst || currStart > indexFirst && currStart <= currEnd && currEnd > indexLast) { - throw new IllegalArgumentException("Range overlapps with an existing copy or move range"); //$NON-NLS-1$ + throw new IllegalArgumentException("Range overlapps with an existing copy or move range"); //$NON-NLS-1$ } } } - + public void prepareMovedNodes(TargetSourceRangeComputer sourceRangeComputer) { if (this.nodeCopySources != null) { prepareSingleNodeCopies(); } - + if (this.nodeRangeInfos != null) { prepareNodeRangeCopies(sourceRangeComputer); } } - + public void revertMovedNodes() { if (this.nodeRangeInfos != null) { removeMoveRangePlaceholders(); } } - + private void removeMoveRangePlaceholders() { for (Iterator iter= this.nodeRangeInfos.entrySet().iterator(); iter.hasNext();) { Map.Entry entry= (Map.Entry) iter.next(); @@ -701,17 +701,17 @@ public final class RewriteEventStore { for (int i= 0; i < rangeInfos.size(); i++) { placeholders.add(((NodeRangeInfo) rangeInfos.get(i)).getInternalPlaceholder()); } - + PropertyLocation loc= (PropertyLocation) entry.getKey(); - + RewriteEvent[] children= getListEvent(loc.getParent(), loc.getProperty(), true).getChildren(); List revertedChildren= new ArrayList(); revertListWithRanges(children, placeholders, revertedChildren); RewriteEvent[] revertedChildrenArr= (RewriteEvent[]) revertedChildren.toArray(new RewriteEvent[revertedChildren.size()]); addEvent(loc.getParent(), loc.getProperty(), new ListRewriteEvent(revertedChildrenArr)); // replace the current edits - } + } } - + private void revertListWithRanges(RewriteEvent[] childEvents, Set placeholders, List revertedChildren) { for (int i= 0; i < childEvents.length; i++) { RewriteEvent event= childEvents[i]; @@ -730,13 +730,13 @@ public final class RewriteEventStore { Map.Entry entry= (Map.Entry) iter.next(); List rangeInfos= (List) entry.getValue(); // list of CopySourceRange Collections.sort(rangeInfos); // sort by start index, length, move or copy - + PropertyLocation loc= (PropertyLocation) entry.getKey(); RewriteEvent[] children= getListEvent(loc.getParent(), loc.getProperty(), true).getChildren(); - + RewriteEvent[] newChildren= processListWithRanges(rangeInfos, children, sourceRangeComputer); addEvent(loc.getParent(), loc.getProperty(), new ListRewriteEvent(newChildren)); // replace the current edits - } + } } private RewriteEvent[] processListWithRanges(List rangeInfos, RewriteEvent[] childEvents, TargetSourceRangeComputer sourceRangeComputer) { @@ -747,14 +747,14 @@ public final class RewriteEventStore { Iterator rangeInfoIterator= rangeInfos.iterator(); NodeRangeInfo nextInfo= (NodeRangeInfo) rangeInfoIterator.next(); - + for (int k= 0; k < childEvents.length; k++) { RewriteEvent event= childEvents[k]; ASTNode node= (ASTNode) event.getOriginalValue(); // check for ranges and add a placeholder for them while (nextInfo != null && node == nextInfo.getStartNode()) { // is this child the beginning of a range? nextInfo.updatePlaceholderSourceRanges(sourceRangeComputer); - + Block internalPlaceholder= nextInfo.getInternalPlaceholder(); RewriteEvent newEvent; if (nextInfo.isMove()) { @@ -766,23 +766,23 @@ public final class RewriteEventStore { if (nextInfo.editGroup != null) { setEventEditGroup(newEvent, nextInfo.editGroup); } - + newChildrenStack.push(newChildEvents); topInfoStack.push(topInfo); - + newChildEvents= new ArrayList(childEvents.length); topInfo= nextInfo; - + nextInfo= rangeInfoIterator.hasNext() ? (NodeRangeInfo) rangeInfoIterator.next() : null; } - + newChildEvents.add(event); while (topInfo != null && node == topInfo.getEndNode()) { RewriteEvent[] placeholderChildEvents= (RewriteEvent[]) newChildEvents.toArray(new RewriteEvent[newChildEvents.size()]); Block internalPlaceholder= topInfo.getInternalPlaceholder(); addEvent(internalPlaceholder, Block.STATEMENTS_PROPERTY, new ListRewriteEvent(placeholderChildEvents)); - + newChildEvents= (List) newChildrenStack.pop(); topInfo= (NodeRangeInfo) topInfoStack.pop(); } @@ -800,9 +800,9 @@ public final class RewriteEventStore { doMarkMovedAsRemoved(curr, curr.location.getParent(), curr.location.getProperty()); } } - + } - + private void doMarkMovedAsRemoved(CopySourceInfo curr, ASTNode parent, StructuralPropertyDescriptor childProperty) { if (childProperty.isChildListProperty()) { ListRewriteEvent event= getListEvent(parent, childProperty, true); @@ -818,7 +818,7 @@ public final class RewriteEventStore { } } - public boolean isInsertBoundToPrevious(ASTNode node) { + public boolean isInsertBoundToPrevious(ASTNode node) { if (this.insertBoundToPrevious != null) { return this.insertBoundToPrevious.contains(node); } @@ -831,28 +831,28 @@ public final class RewriteEventStore { } this.insertBoundToPrevious.add(node); } - + private void validateIsListProperty(StructuralPropertyDescriptor property) { if (!property.isChildListProperty()) { String message= property.getId() + " is not a list property"; //$NON-NLS-1$ throw new IllegalArgumentException(message); } } - + private void validateHasChildProperty(ASTNode parent, StructuralPropertyDescriptor property) { if (!parent.structuralPropertiesForType().contains(property)) { String message= Signature.getSimpleName(parent.getClass().getName()) + " has no property " + property.getId(); //$NON-NLS-1$ throw new IllegalArgumentException(message); } } - + private void validateIsNodeProperty(StructuralPropertyDescriptor property) { if (property.isChildListProperty()) { String message= property.getId() + " is not a node property"; //$NON-NLS-1$ throw new IllegalArgumentException(message); } - } - + } + public String toString() { StringBuffer buf= new StringBuffer(); for (Iterator iter = this.eventLookup.values().iterator(); iter.hasNext();) { @@ -863,7 +863,7 @@ public final class RewriteEventStore { } return buf.toString(); } - + public static boolean isNewNode(ASTNode node) { return (node.getFlags() & ASTNode.ORIGINAL) == 0; } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/SourceModifier.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/SourceModifier.java index 9e83303b6..a22669a04 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/SourceModifier.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/SourceModifier.java @@ -19,24 +19,24 @@ import org.eclipse.text.edits.ReplaceEdit; public class SourceModifier implements ISourceModifier { - + private final String destinationIndent; private final int sourceIndentLevel; private final int tabWidth; private final int indentWidth; - + public SourceModifier(int sourceIndentLevel, String destinationIndent, int tabWidth, int indentWidth) { this.destinationIndent= destinationIndent; this.sourceIndentLevel= sourceIndentLevel; this.tabWidth= tabWidth; this.indentWidth= indentWidth; } - + public ISourceModifier copy() { // We are state less return this; } - + public ReplaceEdit[] getModifications(String source) { List result= new ArrayList(); int destIndentLevel= IndentManipulation.measureIndentUnits(this.destinationIndent, this.tabWidth, this.indentWidth); diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java index 3c971f4ae..c2bc83615 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java @@ -24,7 +24,7 @@ public class TrackedNodePosition implements ITrackedNodePosition { private final TextEditGroup group; private final ASTNode node; - + public TrackedNodePosition(TextEditGroup group, ASTNode node) { this.group= group; this.node= node; diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java index 94b9c97ac..94473aa27 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java @@ -913,7 +913,7 @@ public class DefaultCodeFormatterConstants { * void bar1() {} * void bar2() {} * } - * </pre> + * </pre></p> * </li> * <li>If no enabling tag is found by the formatter after the disabling tag, then * the end of the snippet won't be formatted.<br> @@ -951,7 +951,45 @@ public class DefaultCodeFormatterConstants { * <li>The tag cannot include newline character (i.e. '\n') but it can have white * spaces.<br> * E.g. "<b>format: off</b>" is a valid disabling tag.<br> - * In the future, newlines may be used to support multiple disabling tags.</li> + * In the future, newlines may be used to support multiple disabling tags. + * </li> + * <li>The tag can include line or block comments start/end tokens. + * <p>If such tags are used, e.g. "<b>//J-</b>", then the single comment can + * also stop the formatting as shown in the following snippet:</p> + * <pre> + * //J- + * // Formatting was stopped from comment above... + * public class X { + * //J+ + * // Formatting is restarted from here... + * void foo() {} + * </pre> + * <p>As any disabling tags, as soon as a comment includes it, + * the formatting stops from this comment:</p> + * <pre> + * public class X { + * // Line comment including the disabling tag: //J- + * // Formatting was stopped from comment above... + * void foo1() {} + * //J+ + * // Formatting restarts from here... + * void bar1() {} + * /* + * * Block comment including the disabling tag: //J+ + * * The formatter stops from this comment... + * */ + * void foo2() {} + * //J+ + * // Formatting restarts from here... + * void bar2() {} + * /** + * * Javadoc comment including the enabling tag: //J+ + * * The formatter stops from this comment... + * */ + * void foo3() {} + * } + * </pre> + * </li> * </ol> * </p> * @since 3.6 @@ -1012,7 +1050,7 @@ public class DefaultCodeFormatterConstants { * // @formatter:on * void bar2() {} * } - * </pre> + * </pre></p> * </li> * <li>If a mix of disabling and enabling tags is done in the same comment, then * the formatter will only take into account the last encountered tag in the @@ -1033,10 +1071,54 @@ public class DefaultCodeFormatterConstants { * void bar() {} * } * </pre> + * </li> * <li>The tag cannot include newline character (i.e. '\n') but it can have white * spaces.<br> * E.g. "<b>format: on</b>" is a valid enabling tag<br> - * In the future, newlines may be used to support multiple enabling tags.</li> + * In the future, newlines may be used to support multiple enabling tags. + * </li> + * <li>The tag can include line or block comments start/end tokens. Javadoc + * tokens are not considered as valid tags. + * <p>If such tags are used, e.g. "<b>//J+</b>", then the single comment can + * also start the formatting as shown in the following snippet:</p> + * <pre> + * //J- + * // Formatting was stopped from comment above... + * public class X { + * //J+ + * // Formatting restarts from here... + * void foo() {} + * } + * </pre> + * <p>As any enabling tags, as soon as a comment includes it, + * the formatting restarts just after the comment:</p> + * <pre> + * public class X { + * //J- + * // Formatting was stopped from comment above... + * void foo1() {} + * // Line comment including the enabling tag: //J+ + * // Formatting restarts from here... + * void bar1() {} + * //J- + * // Formatting was stopped from comment above... + * void foo2() {} + * /* + * * Block comment including the enabling tag: //J+ + * * The formatter restarts after this comment... + * */ + * // Formatting restarts from here... + * void bar2() {} + * //J- + * // Formatting was stopped from comment above... + * void foo3() {} + * /** + * * Javadoc comment including the enabling tag: //J+ + * * The formatter restarts after this comment... + * */ + * void bar3() {} + * } + * </pre> * </li> * </ol> * </p> @@ -1206,11 +1288,69 @@ public class DefaultCodeFormatterConstants { * @see JavaCore#INSERT * @see JavaCore#DO_NOT_INSERT * @since 3.4 + * @deprecated + * All new options must be enabled to activate old strategy + * {@link #FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD} + * {@link #FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD} + * {@link #FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE} + * {@link #FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE} */ public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_annotation_on_member";//$NON-NLS-1$ /** * <pre> + * FORMATTER / Option to insert a new line after an annotation on a field declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT + * </pre> + * @see JavaCore#INSERT + * @see JavaCore#DO_NOT_INSERT + * @since 3.7 + */ + public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_annotation_on_field";//$NON-NLS-1$ + + /** + * <pre> + * FORMATTER / Option to insert a new line after an annotation on a method declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT + * </pre> + * @see JavaCore#INSERT + * @see JavaCore#DO_NOT_INSERT + * @since 3.7 + */ + public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_annotation_on_method";//$NON-NLS-1$ + + /** + * <pre> + * FORMATTER / Option to insert a new line after an annotation on a package declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT + * </pre> + * @see JavaCore#INSERT + * @see JavaCore#DO_NOT_INSERT + * @since 3.7 + */ + public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_annotation_on_package";//$NON-NLS-1$ + + /** + * <pre> + * FORMATTER / Option to insert a new line after an annotation on a type declaration + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: INSERT + * </pre> + * @see JavaCore#INSERT + * @see JavaCore#DO_NOT_INSERT + * @since 3.7 + */ + public static final String FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_annotation_on_type";//$NON-NLS-1$ + + /** + * <pre> * FORMATTER / Option to insert a new line after an annotation on a parameter * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" * - possible values: { INSERT, DO_NOT_INSERT } diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java index d5a9b2d8b..053a79c7a 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java @@ -670,7 +670,7 @@ public class CodeFormatterVisitor extends ASTVisitor { Alignment memberAlignment = this.scribe.getMemberAlignment(); this.scribe.printComment(); - this.scribe.printModifiers(fieldDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(fieldDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_FIELD); this.scribe.space(); /* * Field type @@ -793,7 +793,7 @@ public class CodeFormatterVisitor extends ASTVisitor { Alignment fieldAlignment = this.scribe.getMemberAlignment(); this.scribe.printComment(); - this.scribe.printModifiers(multiFieldDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(multiFieldDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_FIELD); this.scribe.space(); multiFieldDeclaration.declarations[0].type.traverse(this, scope); @@ -1055,7 +1055,7 @@ public class CodeFormatterVisitor extends ASTVisitor { this.scribe.printComment(); int line = this.scribe.line; - this.scribe.printModifiers(typeDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(typeDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_TYPE); if (this.scribe.line > line) { // annotations introduced new line, but this is not a line wrapping @@ -2619,7 +2619,7 @@ public class CodeFormatterVisitor extends ASTVisitor { * Print comments to get proper line number */ this.scribe.printComment(); - this.scribe.printModifiers(annotationTypeMemberDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(annotationTypeMemberDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_METHOD); this.scribe.space(); /* * Print the method return type @@ -3246,7 +3246,7 @@ public class CodeFormatterVisitor extends ASTVisitor { this.scribe.printEmptyLines(blankLinesBeforePackage); } - this.scribe.printModifiers(currentPackage.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(currentPackage.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_PACKAGE); this.scribe.space(); // dump the package keyword this.scribe.printNextToken(TerminalTokens.TokenNamepackage); @@ -3482,7 +3482,7 @@ public class CodeFormatterVisitor extends ASTVisitor { */ this.scribe.printComment(); int line = this.scribe.line; - this.scribe.printModifiers(constructorDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(constructorDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_METHOD); if (this.scribe.line > line) { // annotations introduced new line, but this is not a line wrapping // see 158267 @@ -3699,7 +3699,7 @@ public class CodeFormatterVisitor extends ASTVisitor { */ this.scribe.printComment(); final int line = this.scribe.line; - this.scribe.printModifiers(enumConstant.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(enumConstant.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_FIELD); this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier, false); formatEnumConstantArguments( enumConstant, @@ -4395,7 +4395,7 @@ public class CodeFormatterVisitor extends ASTVisitor { do { try { - this.scribe.printModifiers(methodDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_MEMBER); + this.scribe.printModifiers(methodDeclaration.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_METHOD); int fragmentIndex = 0; this.scribe.alignFragment(methodDeclAlignment, fragmentIndex); diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java index 627fa8372..07d8634b5 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java @@ -145,7 +145,10 @@ public class DefaultCodeFormatterOptions { public boolean indent_switchstatements_compare_to_switch; public int indentation_size; - public boolean insert_new_line_after_annotation_on_member; + public boolean insert_new_line_after_annotation_on_type; + public boolean insert_new_line_after_annotation_on_field; + public boolean insert_new_line_after_annotation_on_method; + public boolean insert_new_line_after_annotation_on_package; public boolean insert_new_line_after_annotation_on_parameter; public boolean insert_new_line_after_annotation_on_local_variable; public boolean insert_new_line_after_label; @@ -431,7 +434,10 @@ public class DefaultCodeFormatterOptions { options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, this.indent_switchstatements_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, this.indent_switchstatements_compare_to_switch ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_INDENTATION_SIZE, Integer.toString(this.indentation_size)); - options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER, this.insert_new_line_after_annotation_on_member ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE, this.insert_new_line_after_annotation_on_type ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD, this.insert_new_line_after_annotation_on_field ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD, this.insert_new_line_after_annotation_on_method ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE, this.insert_new_line_after_annotation_on_package ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER, this.insert_new_line_after_annotation_on_parameter ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE, this.insert_new_line_after_annotation_on_local_variable ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_after_opening_brace_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT); @@ -2047,16 +2053,41 @@ public class DefaultCodeFormatterOptions { this.comment_clear_blank_lines_in_block_comment = DefaultCodeFormatterConstants.TRUE.equals(commentClearBlankLinesInBlockCommentOption); } } - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 + // New line after annotations final Object insertNewLineAfterAnnotationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION); - if (insertNewLineAfterAnnotationOption != null) { // check if deprecated option was used - this.insert_new_line_after_annotation_on_member = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOption); - this.insert_new_line_after_annotation_on_parameter = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOption); - this.insert_new_line_after_annotation_on_local_variable = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOption); + if (insertNewLineAfterAnnotationOption != null) { // check if deprecated 3.1 option was used + boolean insert = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOption); + this.insert_new_line_after_annotation_on_type = insert; + this.insert_new_line_after_annotation_on_field = insert; + this.insert_new_line_after_annotation_on_method = insert; + this.insert_new_line_after_annotation_on_package = insert; + this.insert_new_line_after_annotation_on_parameter = insert; + this.insert_new_line_after_annotation_on_local_variable = insert; } else { final Object insertNewLineAfterAnnotationOnMemberOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER); - if (insertNewLineAfterAnnotationOnMemberOption != null) { // otherwhise, use the new options - this.insert_new_line_after_annotation_on_member = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOnMemberOption); + if (insertNewLineAfterAnnotationOnMemberOption != null) { // check if deprecated 3.4 option was used + boolean insert = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOnMemberOption); + this.insert_new_line_after_annotation_on_type = insert; + this.insert_new_line_after_annotation_on_field = insert; + this.insert_new_line_after_annotation_on_method = insert; + this.insert_new_line_after_annotation_on_package = insert; + } else { // otherwise use new options + final Object insertNewLineAfterAnnotationOnTypeOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE); + if (insertNewLineAfterAnnotationOnTypeOption != null) { + this.insert_new_line_after_annotation_on_type = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOnTypeOption); + } + final Object insertNewLineAfterAnnotationOnFieldOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD); + if (insertNewLineAfterAnnotationOnFieldOption != null) { + this.insert_new_line_after_annotation_on_field = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOnFieldOption); + } + final Object insertNewLineAfterAnnotationOnMethodOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD); + if (insertNewLineAfterAnnotationOnMethodOption != null) { + this.insert_new_line_after_annotation_on_method = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOnMethodOption); + } + final Object insertNewLineAfterAnnotationOnPackageOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE); + if (insertNewLineAfterAnnotationOnPackageOption != null) { + this.insert_new_line_after_annotation_on_package = JavaCore.INSERT.equals(insertNewLineAfterAnnotationOnPackageOption); + } } final Object insertNewLineAfterAnnotationOnParameterOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER); if (insertNewLineAfterAnnotationOnParameterOption != null) { @@ -2145,7 +2176,10 @@ public class DefaultCodeFormatterOptions { this.indent_switchstatements_compare_to_cases = true; this.indent_switchstatements_compare_to_switch = true; this.indentation_size = 4; - this.insert_new_line_after_annotation_on_member = true; + this.insert_new_line_after_annotation_on_type = true; + this.insert_new_line_after_annotation_on_field = true; + this.insert_new_line_after_annotation_on_method = true; + this.insert_new_line_after_annotation_on_package = true; this.insert_new_line_after_annotation_on_parameter = false; this.insert_new_line_after_annotation_on_local_variable = true; this.insert_new_line_after_opening_brace_in_array_initializer = false; @@ -2424,7 +2458,10 @@ public class DefaultCodeFormatterOptions { this.indent_switchstatements_compare_to_cases = true; this.indent_switchstatements_compare_to_switch = false; this.indentation_size = 4; - this.insert_new_line_after_annotation_on_member = true; + this.insert_new_line_after_annotation_on_type = true; + this.insert_new_line_after_annotation_on_field = true; + this.insert_new_line_after_annotation_on_method = true; + this.insert_new_line_after_annotation_on_package = true; this.insert_new_line_after_annotation_on_parameter = false; this.insert_new_line_after_annotation_on_local_variable = true; this.insert_new_line_after_opening_brace_in_array_initializer = false; diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java index daf6fc4d1..472f4f032 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java @@ -187,7 +187,7 @@ FormatJavadocText[] getTextHierarchy(FormatJavadocNode node, int htmlDepth) { if (lastText.depth == htmlDepth || // found same html tag level => use it lastText.htmlNodesPtr == -1) { // no more sub-levels => add one // Text breakage - if (lastText.isHtmlTag() && text != null) { + if (lastText.isHtmlTag()) { // Set some lines before if previous was specific html tag // The added text is concerned if the parent has no child yet or is top level and closing html tag boolean setLinesBefore = lastText.separatorsPtr == -1 || (ptr == 0 && lastText.isClosingHtmlTag()); @@ -202,19 +202,19 @@ FormatJavadocText[] getTextHierarchy(FormatJavadocNode node, int htmlDepth) { if (setLinesBefore) { switch (lastText.getHtmlTagID()) { case JAVADOC_CODE_TAGS_ID: - if (text.linesBefore < 2) { - text.linesBefore = 2; + if (node.linesBefore < 2) { + node.linesBefore = 2; } break; case JAVADOC_SEPARATOR_TAGS_ID: case JAVADOC_SINGLE_BREAK_TAG_ID: - if (text.linesBefore < 1) { - text.linesBefore = 1; + if (node.linesBefore < 1) { + node.linesBefore = 1; } } } // If adding an html tag on same html tag, then close previous one and leave - if (text.isHtmlTag() && !text.isClosingHtmlTag() && text.getHtmlTagIndex() == lastText.getHtmlTagIndex() && !lastText.isClosingHtmlTag()) { + if (text != null && text.isHtmlTag() && !text.isClosingHtmlTag() && text.getHtmlTagIndex() == lastText.getHtmlTagIndex() && !lastText.isClosingHtmlTag()) { lastText.closeTag(); return textHierarchy; } diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/ICodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/ICodeFormatterConstants.java index 2e31505f0..59ed3a059 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/ICodeFormatterConstants.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/ICodeFormatterConstants.java @@ -13,23 +13,32 @@ package org.eclipse.jdt.internal.formatter; /** * Internal code formatter constants. - * + * * @since 3.4 */ public interface ICodeFormatterConstants { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 // constants used to handle the addition of new lines after annotations - + /** annotation on unspecified source*/ public static final int ANNOTATION_UNSPECIFIED = 0; - - /** annotation on a member (type, method, field) */ - public static final int ANNOTATION_ON_MEMBER = 1; + + /** annotation on a type */ + public static final int ANNOTATION_ON_TYPE = 1; + + /** annotation on a field */ + public static final int ANNOTATION_ON_FIELD = 2; + + /** annotation on a method */ + public static final int ANNOTATION_ON_METHOD = 3; + + /** annotation on a package */ + public static final int ANNOTATION_ON_PACKAGE = 4; /** annotation on a parameter */ - public static final int ANNOTATION_ON_PARAMETER = 2; + public static final int ANNOTATION_ON_PARAMETER = 5; /** annotation on a local variable */ - public static final int ANNOTATION_ON_LOCAL_VARIABLE = 3; + public static final int ANNOTATION_ON_LOCAL_VARIABLE = 6; } diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OptimizedReplaceEdit.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OptimizedReplaceEdit.java index 5435396a5..d9b957040 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OptimizedReplaceEdit.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OptimizedReplaceEdit.java @@ -23,6 +23,6 @@ public class OptimizedReplaceEdit { } public String toString() { - return "(" + this.offset + ", length " + this.length + " :>" + this.replacement + "<"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ + return (this.offset < 0 ? "(" : "X(") + this.offset + ", length " + this.length + " :>" + this.replacement + "<"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ //$NON-NLS-5$ } } diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java index 02d2fd161..6d7fd2289 100644 --- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java +++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java @@ -111,6 +111,7 @@ public class Scribe implements IJavaDocTagConstants { /** disabling */ boolean editsEnabled; boolean useTags; + int tagsKind; /* Comments formatting */ private static final int INCLUDE_BLOCK_COMMENTS = CodeFormatter.F_INCLUDE_COMMENTS | CodeFormatter.K_MULTI_LINE_COMMENT; @@ -228,26 +229,12 @@ public class Scribe implements IJavaDocTagConstants { // the offset of the region is inside a comment => restart the region from the comment start adaptedOffset = this.commentPositions[index][0]; if (adaptedOffset >= 0) { - // adapt only javadoc or block commments. Since fix for bug + // adapt only javadoc or block comments. Since fix for bug // https://bugs.eclipse.org/bugs/show_bug.cgi?id=238210 // edits in line comments only concerns whitespaces hence can be // treated as edits in code adaptedLength = length + offset - adaptedOffset; commentIndex = index; - // include also the indentation edit just before the comment if any - for (int j=0; j<this.editsIndex; j++) { - int editOffset = this.edits[j].offset; - int editEnd = editOffset + this.edits[j].length; - if (editEnd == adaptedOffset) { - if (j > 0 && this.edits[j].replacement.trim().length() == 0) { - adaptedLength += adaptedOffset - this.edits[j].offset; - adaptedOffset = editOffset; - break; - } - } else if (editEnd > adaptedOffset) { - break; - } - } } } index = getCommentIndex(commentIndex, offset+length-1); @@ -308,6 +295,14 @@ public class Scribe implements IJavaDocTagConstants { currentEdit = index; } } + + // Set invalid all edits outside the region + if (currentEdit != -1) { + int length = sortedEdits.length; + for (int e=currentEdit; e<length; e++) { + sortedEdits[e].offset = -1; + } + } } /* @@ -325,12 +320,12 @@ public class Scribe implements IJavaDocTagConstants { * region. */ private int adaptEdit(OptimizedReplaceEdit[] sortedEdits, int start, int regionStart, int regionEnd) { - int bottom = start==-1?0:start, top = sortedEdits.length - 1; + int initialStart = start==-1 ? 0 : start; + int bottom = initialStart, top = sortedEdits.length - 1; int topEnd = top; int i = 0; OptimizedReplaceEdit edit = null; int overlapIndex = -1; - int linesOutside= -1; // Look for an edit overlapping the region start while (bottom <= top) { @@ -338,28 +333,37 @@ public class Scribe implements IJavaDocTagConstants { edit = sortedEdits[i]; int editStart = edit.offset; int editEnd = editStart + edit.length; - if (regionStart < editStart) { // the edit starts after the region's start => no possible overlap of region's start + if (editStart > regionStart) { // the edit starts after the region's start => no possible overlap of region's start top = i-1; - if (regionEnd < editStart) { // the edit starts after the region's end => no possible overlap of region's end + if (editStart > regionEnd) { // the edit starts after the region's end => no possible overlap of region's end topEnd = top; } } else { - if (regionStart >= editEnd) { // the edit ends before the region's start => no possible overlap of region's start + if (editEnd < regionStart) { // the edit ends before the region's start => no possible overlap of region's start bottom = i+1; } else { // Count the lines of the edit which are outside the region - linesOutside = 0; + int linesOutside = 0; + StringBuffer spacesOutside = new StringBuffer(); this.scanner.resetTo(editStart, editEnd-1); - while (!this.scanner.atEnd()) { - boolean before = this.scanner.currentPosition < regionStart; - char ch = (char) this.scanner.getNextChar(); - if (ch == '\n' ) { - if (before) linesOutside++; - } - } + while (this.scanner.currentPosition < regionStart && !this.scanner.atEnd()) { + char ch = (char) this.scanner.getNextChar(); + switch (ch) { + case '\n': + linesOutside++; + spacesOutside.setLength(0); + break; + case '\r': + break; + default: + spacesOutside.append(ch); + break; + } + } // Restart the edit at the beginning of the line where the region start edit.offset = regionStart; + int editLength = edit.length; edit.length -= edit.offset - editStart; // Cut replacement string if necessary @@ -372,36 +376,64 @@ public class Scribe implements IJavaDocTagConstants { if (edit.replacement.charAt(idx) == '\n') linesReplaced++; } - // As the edit starts outside the region, remove first lines from edit string if any - if (linesReplaced > 0) { - int linesCount = linesOutside >= linesReplaced ? linesReplaced : linesOutside; - if (linesCount > 0) { - int idx=0; - loop: while (idx < length) { - char ch = edit.replacement.charAt(idx); - switch (ch) { - case '\n': - linesCount--; - if (linesCount == 0) { - idx++; - break loop; - } - break; - case '\r': - case ' ': - case '\t': - break; - default: - break loop; - } - idx++; - } - if (idx >= length) { - edit.replacement = ""; //$NON-NLS-1$ - } else { - edit.replacement = edit.replacement.substring(idx); - } - } + // If the edit was a replacement but become an insertion due to the length reduction + // and if the edit finishes just before the region starts and if there's no line to replace + // then there's no replacement to do... + if (editLength > 0 && edit.length == 0 && editEnd == regionStart && linesReplaced == 0 && linesOutside== 0) { + edit.offset = -1; + } else { + + // As the edit starts outside the region, remove first lines from edit string if any + if (linesReplaced > 0) { + int linesCount = linesOutside >= linesReplaced ? linesReplaced : linesOutside; + if (linesCount > 0) { + int idx = 0; + loop: while (idx < length) { + char ch = edit.replacement.charAt(idx); + switch (ch) { + case '\n': + linesCount--; + if (linesCount == 0) { + idx++; + break loop; + } + break; + case '\r': + case ' ': + case '\t': + break; + default: + break loop; + } + idx++; + } + // Compare spaces outside the region and the beginning + // of the replacement string to remove the common part + int spacesOutsideLength = spacesOutside.length(); + int replacementStart = idx; + for (int o=0, r=0; o < spacesOutsideLength && r<(length-idx); o++) { + char rch = edit.replacement.charAt(idx + r); + char och = spacesOutside.charAt(o); + if (rch == och) { + replacementStart++; + r++; + } else if (rch == '\t' && (this.tabLength > 0 && och == ' ')) { + if ((o+1)%this.tabLength == 0) { + replacementStart++; + r++; + } + } else { + break; + } + } + // Update the replacement string + if (replacementStart >= length) { + edit.offset = -1; + } else { + edit.replacement = edit.replacement.substring(replacementStart); + } + } + } } } overlapIndex = i; @@ -409,6 +441,7 @@ public class Scribe implements IJavaDocTagConstants { } } } + int validIndex = (overlapIndex != -1) ? overlapIndex : bottom; // Look for an edit overlapping the region end if (overlapIndex != -1) bottom = overlapIndex; @@ -417,53 +450,87 @@ public class Scribe implements IJavaDocTagConstants { edit = sortedEdits[i]; int editStart = edit.offset; int editEnd = editStart + edit.length; - if (regionEnd < editStart) { // the edit starts after the region's end => no possible overlap of region's end + if (regionEnd < editStart) { // the edit starts after the region's end => no possible overlap of region's end topEnd = i-1; - } else { - if (regionEnd >= editEnd) { // the edit ends before the region's end => no possible overlap of region's end - bottom = i+1; - } else { - // Count the lines of the edit which are outside the region - linesOutside = 0; - this.scanner.resetTo(editStart, editEnd-1); - while (!this.scanner.atEnd()) { - boolean after = this.scanner.currentPosition >= regionEnd; - char ch = (char) this.scanner.getNextChar(); - if (ch == '\n' ) { - if (after) linesOutside++; - } - } + } else if (regionEnd == editStart) { // special case when the edit starts just after the region's end... + // ...we got the last index of the edit inside the region + topEnd = i - 1; + // this last edit is valid only if it's an insertion and if it has indentation + if (edit.length == 0) { + int nrLength = 0; + int rLength = edit.replacement.length(); + int ch = edit.replacement.charAt(nrLength); + loop: while (nrLength < rLength) { + switch (ch) { + case ' ': + case '\t': + nrLength++; + break; + default: + break loop; + } + } + if (nrLength > 0) { + topEnd++; + if (nrLength < rLength) { + edit.replacement = edit.replacement.substring(0, nrLength); + } + } + } + break; + } else if (editEnd <= regionEnd) { // the edit ends before the region's end => no possible overlap of region's end + bottom = i+1; + } else { + // Count the lines of the edit which are outside the region + int linesOutside = 0; + this.scanner.resetTo(editStart, editEnd-1); + while (!this.scanner.atEnd()) { + boolean after = this.scanner.currentPosition >= regionEnd; + char ch = (char) this.scanner.getNextChar(); + if (ch == '\n' ) { + if (after) linesOutside++; + } + } - // Cut replacement string if necessary - int length = edit.replacement.length(); - if (length > 0) { + // Cut replacement string if necessary + int length = edit.replacement.length(); + if (length > 0) { - // Count the lines in replacement string - int linesReplaced = 0; - for (int idx=0; idx < length; idx++) { - if (edit.replacement.charAt(idx) == '\n') linesReplaced++; - } + // Count the lines in replacement string + int linesReplaced = 0; + for (int idx=0; idx < length; idx++) { + if (edit.replacement.charAt(idx) == '\n') linesReplaced++; + } - // Set the replacement string to the number of missing new lines - // As the end of the edit is out of the region, the possible trailing - // indentation should not be added... - if (linesReplaced == 0) { + // Set the replacement string to the number of missing new lines + // As the end of the edit is out of the region, the possible trailing + // indentation should not be added... + if (linesReplaced == 0) { + edit.replacement = ""; //$NON-NLS-1$ + } else { + int linesCount = linesReplaced > linesOutside ? linesReplaced - linesOutside : 0; + if (linesCount == 0) { edit.replacement = ""; //$NON-NLS-1$ } else { - int linesCount = linesReplaced > linesOutside ? linesReplaced - linesOutside : 0; - if (linesCount == 0) { - edit.replacement = ""; //$NON-NLS-1$ - } else { - edit.replacement = getNewLineString(linesCount); - } + edit.replacement = getNewLineString(linesCount); } } - edit.length -= editEnd - regionEnd; - return i; } + edit.length = regionEnd - editStart; + + // We got the last edit of the regions, give up + topEnd = i; + break; } } - return overlapIndex; + + // Set invalid all edits outside the region + for (int e=initialStart; e<validIndex; e++) { + sortedEdits[e].offset = -1; + } + + // Return the index of next edit to look at + return topEnd+1; } private final void addDeleteEdit(int start, int end) { @@ -821,24 +888,6 @@ public class Scribe implements IJavaDocTagConstants { return -1; } - private IRegion getCoveringAdaptedRegion(int offset, int end) { - int index = getIndexOfAdaptedRegionAt(offset); - - if (index < 0) { - index = -(index + 1); - index--; - if (index < 0) { - return null; - } - } - - IRegion region = this.adaptedRegions[index]; - if ((region.getOffset() <= offset) && (end <= region.getOffset() + region.getLength() - 1)) { - return region; - } - return null; - } - private int getCurrentCommentIndentation(int start) { int linePtr = -Arrays.binarySearch(this.lineEnds, start); int indentation = 0; @@ -884,6 +933,7 @@ public class Scribe implements IJavaDocTagConstants { } int getCurrentIndentation(char[] whitespaces, int offset) { + if (whitespaces == null) return offset; int length = whitespaces.length; if (this.tabLength == 0) return length; int indentation = offset; @@ -1012,24 +1062,6 @@ public class Scribe implements IJavaDocTagConstants { return emptyLines; } - private int getIndexOfAdaptedRegionAt(int offset) { - if (this.adaptedRegions.length == 1) { - int offset2 = this.adaptedRegions[0].getOffset(); - if (offset2 == offset) { - return 0; - } - return offset2 < offset ? -2 : -1; - } - return Arrays.binarySearch(this.adaptedRegions, new Region(offset, 0), new Comparator() { - public int compare(Object o1, Object o2) { - int r1Offset = ((IRegion)o1).getOffset(); - int r2Offset = ((IRegion)o2).getOffset(); - - return r1Offset - r2Offset; - } - }); - } - public OptimizedReplaceEdit getLastEdit() { if (this.editsIndex > 0) { return this.edits[this.editsIndex - 1]; @@ -1182,8 +1214,10 @@ public class Scribe implements IJavaDocTagConstants { linePtr = -linePtr - 1; } int i = getLineEnd(linePtr)+1; - while (this.scanner.source[i] != '\r') { - System.out.print(this.scanner.source[i++]); + char[] source = this.scanner.source; + int sourceLength = source.length; + while (i < sourceLength && source[i] != '\r') { + System.out.print(source[i++]); } System.out.println(); System.out.println(" - indentation level = "+this.indentationLevel); //$NON-NLS-1$ @@ -1210,15 +1244,6 @@ public class Scribe implements IJavaDocTagConstants { return getNewLine(); } - private IRegion getAdaptedRegionAt(int offset) { - int index = getIndexOfAdaptedRegionAt(offset); - if (index < 0) { - return null; - } - - return this.adaptedRegions[index]; - } - public TextEdit getRootEdit() { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=208541 adaptRegions(); @@ -1251,14 +1276,16 @@ public class Scribe implements IJavaDocTagConstants { } for (int i= 0, max = this.editsIndex; i < max; i++) { OptimizedReplaceEdit currentEdit = this.edits[i]; - if (isValidEdit(currentEdit)) { - try { - edit.addChild(new ReplaceEdit(currentEdit.offset, currentEdit.length, currentEdit.replacement)); - } - catch (MalformedTreeException ex) { - // log exception in case of error - CommentFormatterUtil.log(ex); - throw ex; + if (currentEdit.offset >= 0 && currentEdit.offset <= this.scannerEndPosition) { + if (currentEdit.length == 0 || (currentEdit.offset != this.scannerEndPosition && isMeaningfulEdit(currentEdit))) { + try { + edit.addChild(new ReplaceEdit(currentEdit.offset, currentEdit.length, currentEdit.replacement)); + } + catch (MalformedTreeException ex) { + // log exception in case of error + CommentFormatterUtil.log(ex); + throw ex; + } } } } @@ -1425,6 +1452,7 @@ public class Scribe implements IJavaDocTagConstants { private void initializeScanner(long sourceLevel, DefaultCodeFormatterOptions preferences) { this.useTags = preferences.use_tags; + this.tagsKind = 0; char[][] taskTags = null; if (this.useTags) { this.disablingTag = preferences.disabling_tag; @@ -1439,6 +1467,23 @@ public class Scribe implements IJavaDocTagConstants { taskTags = new char[][] { this.disablingTag, this.enablingTag }; } } + if (taskTags != null) { + loop: for (int i=0,length=taskTags.length; i<length; i++) { + if (taskTags[i].length > 2 && taskTags[i][0] == '/') { + switch (taskTags[i][1]) { + case '/': + this.tagsKind = TerminalTokens.TokenNameCOMMENT_LINE; + break loop; + case '*': + if (taskTags[i][2] != '*') { + this.tagsKind = TerminalTokens.TokenNameCOMMENT_BLOCK; + break loop; + } + break; + } + } + } + } this.scanner = new Scanner(true, true, false/*nls*/, sourceLevel/*sourceLevel*/, taskTags, null/*taskPriorities*/, true/*taskCaseSensitive*/); this.editsEnabled = true; } @@ -1462,71 +1507,19 @@ public class Scribe implements IJavaDocTagConstants { return previousLineEnd != -1 && previousLineEnd == start - 1; } - private boolean isValidEdit(OptimizedReplaceEdit edit) { + private boolean isMeaningfulEdit(OptimizedReplaceEdit edit) { final int editLength= edit.length; final int editReplacementLength= edit.replacement.length(); final int editOffset= edit.offset; - if (editLength != 0) { - - IRegion covering = getCoveringAdaptedRegion(editOffset, (editOffset + editLength - 1)); - if (covering != null) { - if (editReplacementLength != 0 && editLength == editReplacementLength) { - for (int i = editOffset, max = editOffset + editLength; i < max; i++) { - if (this.scanner.source[i] != edit.replacement.charAt(i - editOffset)) { - return true; - } - } - return false; - } - return true; - } - - IRegion starting = getAdaptedRegionAt(editOffset + editLength); - if (starting != null) { - int i = editOffset; - for (int max = editOffset + editLength; i < max; i++) { - int replacementStringIndex = i - editOffset; - if (replacementStringIndex >= editReplacementLength || this.scanner.source[i] != edit.replacement.charAt(replacementStringIndex)) { - break; - } - } - if (i - editOffset != editReplacementLength && i != editOffset + editLength - 1) { - edit.offset = starting.getOffset(); - edit.length = 0; - edit.replacement = edit.replacement.substring(i - editOffset); + if (editReplacementLength != 0 && editLength == editReplacementLength) { + for (int i = editOffset, max = editOffset + editLength; i < max; i++) { + if (this.scanner.source[i] != edit.replacement.charAt(i - editOffset)) { return true; } } - return false; } - - IRegion covering = getCoveringAdaptedRegion(editOffset, editOffset); - if (covering != null) { - return true; - } - - if (editOffset == this.scannerEndPosition) { - int index = Arrays.binarySearch( - this.adaptedRegions, - new Region(editOffset, 0), - new Comparator() { - public int compare(Object o1, Object o2) { - IRegion r1 = (IRegion)o1; - IRegion r2 = (IRegion)o2; - - int r1End = r1.getOffset() + r1.getLength(); - int r2End = r2.getOffset() + r2.getLength(); - - return r1End - r2End; - } - }); - if (index < 0) { - return false; - } - return true; - } - return false; + return true; } private void preserveEmptyLines(int count, int insertPosition) { @@ -2372,13 +2365,12 @@ public class Scribe implements IJavaDocTagConstants { boolean hasLineComment = false; boolean hasWhitespaces = false; int lines = 0; - int previousFoundTaskCount = this.scanner.foundTaskCount; while ((this.currentToken = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) { int foundTaskCount = this.scanner.foundTaskCount; + int tokenStartPosition = this.scanner.getCurrentTokenStartPosition(); switch(this.currentToken) { case TerminalTokens.TokenNameWHITESPACE : char[] whiteSpaces = this.scanner.getCurrentTokenSource(); - int whitespacesStartPosition = this.scanner.getCurrentTokenStartPosition(); int whitespacesEndPosition = this.scanner.getCurrentTokenEndPosition(); lines = 0; for (int i = 0, max = whiteSpaces.length; i < max; i++) { @@ -2452,7 +2444,7 @@ public class Scribe implements IJavaDocTagConstants { // if a line comment is consumed, no other comment can be on the same line after if (hasLineComment) { if (lines >= 1) { - currentTokenStartPosition = whitespacesStartPosition; + currentTokenStartPosition = tokenStartPosition; preserveEmptyLines(lines, currentTokenStartPosition); addDeleteEdit(currentTokenStartPosition, whitespacesEndPosition); this.scanner.resetTo(this.scanner.currentPosition, this.scannerEndPosition - 1); @@ -2464,7 +2456,7 @@ public class Scribe implements IJavaDocTagConstants { // if one or several new lines are consumed, following comments cannot be considered as trailing ones if (lines >= 1) { if (hasComment) { - this.printNewLine(whitespacesStartPosition); + this.printNewLine(tokenStartPosition); } this.scanner.resetTo(currentTokenStartPosition, this.scannerEndPosition - 1); return; @@ -2472,40 +2464,49 @@ public class Scribe implements IJavaDocTagConstants { // delete consumed white spaces hasWhitespaces = true; currentTokenStartPosition = this.scanner.currentPosition; - addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition); + addDeleteEdit(tokenStartPosition, whitespacesEndPosition); } else { if (lines == 0) { hasWhitespaces = true; - addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition); + addDeleteEdit(tokenStartPosition, whitespacesEndPosition); } else if (hasLineComment) { - currentTokenStartPosition = whitespacesStartPosition; + currentTokenStartPosition = tokenStartPosition; preserveEmptyLines(lines, currentTokenStartPosition); addDeleteEdit(currentTokenStartPosition, whitespacesEndPosition); } else if (hasComment) { if (lines == 1) { - this.printNewLine(whitespacesStartPosition); + this.printNewLine(tokenStartPosition); } else { - preserveEmptyLines(lines - 1, whitespacesStartPosition); + preserveEmptyLines(lines - 1, tokenStartPosition); } - addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition); + addDeleteEdit(tokenStartPosition, whitespacesEndPosition); } else if (lines != 0 && (!this.formatter.preferences.join_wrapped_lines || this.formatter.preferences.number_of_empty_lines_to_preserve != 0 || this.blank_lines_between_import_groups > 0)) { - addReplaceEdit(whitespacesStartPosition, whitespacesEndPosition, getPreserveEmptyLines(lines-1)); + addReplaceEdit(tokenStartPosition, whitespacesEndPosition, getPreserveEmptyLines(lines-1)); } else { - addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition); + addDeleteEdit(tokenStartPosition, whitespacesEndPosition); } } currentTokenStartPosition = this.scanner.currentPosition; break; case TerminalTokens.TokenNameCOMMENT_LINE : - if (this.useTags && this.editsEnabled && foundTaskCount > previousFoundTaskCount) { - setEditsEnabled(foundTaskCount, previousFoundTaskCount); - if (!this.editsEnabled && this.editsIndex > 1) { - OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1]; - if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) { - printNewLinesBeforeDisablingComment(); + if (this.useTags && this.editsEnabled) { + boolean turnOff = false; + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + turnOff = true; + } else if (this.tagsKind == this.currentToken + && CharOperation.fragmentEquals(this.disablingTag, this.scanner.source, tokenStartPosition, true)) { + this.editsEnabled = false; + turnOff = true; + } + if (turnOff) { + if (!this.editsEnabled && this.editsIndex > 1) { + OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1]; + if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) { + printNewLinesBeforeDisablingComment(); + } } } - previousFoundTaskCount = foundTaskCount; } if (rejectLineComment) break; if (lines >= 1) { @@ -2522,20 +2523,33 @@ public class Scribe implements IJavaDocTagConstants { currentTokenStartPosition = this.scanner.currentPosition; hasLineComment = true; lines = 0; - if (this.useTags && !this.editsEnabled && foundTaskCount > previousFoundTaskCount) { - setEditsEnabled(foundTaskCount, previousFoundTaskCount); + if (this.useTags && !this.editsEnabled) { + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + } else if (this.tagsKind == this.currentToken) { + this.editsEnabled = CharOperation.fragmentEquals(this.enablingTag, this.scanner.source, tokenStartPosition, true); + } } break; case TerminalTokens.TokenNameCOMMENT_BLOCK : - if (this.useTags && this.editsEnabled && foundTaskCount > previousFoundTaskCount) { - setEditsEnabled(foundTaskCount, previousFoundTaskCount); - if (!this.editsEnabled && this.editsIndex > 1) { - OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1]; - if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) { - printNewLinesBeforeDisablingComment(); + if (this.useTags && this.editsEnabled) { + boolean turnOff = false; + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + turnOff = true; + } else if (this.tagsKind == this.currentToken + && CharOperation.fragmentEquals(this.disablingTag, this.scanner.source, tokenStartPosition, true)) { + this.editsEnabled = false; + turnOff = true; + } + if (turnOff) { + if (!this.editsEnabled && this.editsIndex > 1) { + OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1]; + if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) { + printNewLinesBeforeDisablingComment(); + } } } - previousFoundTaskCount = foundTaskCount; } if (trailing > NO_TRAILING_COMMENT && lines >= 1) { // a block comment on next line means that there's no trailing comment @@ -2559,20 +2573,23 @@ public class Scribe implements IJavaDocTagConstants { hasLineComment = false; hasComment = true; lines = 0; - if (this.useTags && !this.editsEnabled && foundTaskCount > previousFoundTaskCount) { - setEditsEnabled(foundTaskCount, previousFoundTaskCount); + if (this.useTags && !this.editsEnabled) { + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + } else if (this.tagsKind == this.currentToken) { + this.editsEnabled = CharOperation.fragmentEquals(this.enablingTag, this.scanner.source, tokenStartPosition, true); + } } break; case TerminalTokens.TokenNameCOMMENT_JAVADOC : - if (this.useTags && this.editsEnabled && foundTaskCount > previousFoundTaskCount) { - setEditsEnabled(foundTaskCount, previousFoundTaskCount); + if (this.useTags && this.editsEnabled && foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); if (!this.editsEnabled && this.editsIndex > 1) { OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1]; if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) { printNewLinesBeforeDisablingComment(); } } - previousFoundTaskCount = foundTaskCount; } if (trailing > NO_TRAILING_COMMENT) { // a javadoc comment should not be considered as a trailing comment @@ -2596,8 +2613,8 @@ public class Scribe implements IJavaDocTagConstants { } else { printBlockComment(true); } - if (this.useTags && !this.editsEnabled && foundTaskCount > previousFoundTaskCount) { - setEditsEnabled(foundTaskCount, previousFoundTaskCount); + if (this.useTags && !this.editsEnabled && foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); } printNewLine(); currentTokenStartPosition = this.scanner.currentPosition; @@ -2611,7 +2628,6 @@ public class Scribe implements IJavaDocTagConstants { this.scanner.resetTo(currentTokenStartPosition, this.scannerEndPosition - 1); return; } - previousFoundTaskCount = foundTaskCount; } } catch (InvalidInputException e) { throw new AbortFormatting(e); @@ -2686,8 +2702,7 @@ public class Scribe implements IJavaDocTagConstants { if (this.tabLength == 0) { similarCommentsIndentation = relativeIndentation == 0; } else if (relativeIndentation > -this.tabLength) { - similarCommentsIndentation = this.formatter.preferences.comment_format_line_comment_starting_on_first_column || - (currentCommentIndentation != 0 && this.lastLineComment.currentIndentation != 0); + similarCommentsIndentation = relativeIndentation == 0 || currentCommentIndentation != 0 && this.lastLineComment.currentIndentation != 0; } if (similarCommentsIndentation && this.lastLineComment.indentation != this.indentationLevel) { int currentIndentationLevel = this.indentationLevel; @@ -3925,7 +3940,9 @@ public class Scribe implements IJavaDocTagConstants { // Replace the new line with a single space when there's only one separator // or, if necessary, print the indentation on the last line if (!multiLinesBlock) { - addReplaceEdit(firstLineEnd, end, " "); //$NON-NLS-1$ + if (firstLineEnd > 0) { + addReplaceEdit(firstLineEnd, end, " "); //$NON-NLS-1$ + } } else if (secondLineStart > 0) { if (newLineString == null) { @@ -4441,6 +4458,9 @@ public class Scribe implements IJavaDocTagConstants { boolean hasComment = false; boolean hasModifiers = false; while ((this.currentToken = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) { + int foundTaskCount = this.scanner.foundTaskCount; + int tokenStartPosition = this.scanner.getCurrentTokenStartPosition(); + int tokenEndPosition = this.scanner.getCurrentTokenEndPosition(); switch(this.currentToken) { case TerminalTokens.TokenNamepublic : case TerminalTokens.TokenNameprotected : @@ -4480,8 +4500,23 @@ public class Scribe implements IJavaDocTagConstants { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=122247 boolean shouldAddNewLine = false; switch (annotationSourceKind) { - case ICodeFormatterConstants.ANNOTATION_ON_MEMBER : - if (this.formatter.preferences.insert_new_line_after_annotation_on_member) { + case ICodeFormatterConstants.ANNOTATION_ON_TYPE : + if (this.formatter.preferences.insert_new_line_after_annotation_on_type) { + shouldAddNewLine = true; + } + break; + case ICodeFormatterConstants.ANNOTATION_ON_FIELD : + if (this.formatter.preferences.insert_new_line_after_annotation_on_field) { + shouldAddNewLine = true; + } + break; + case ICodeFormatterConstants.ANNOTATION_ON_METHOD : + if (this.formatter.preferences.insert_new_line_after_annotation_on_method) { + shouldAddNewLine = true; + } + break; + case ICodeFormatterConstants.ANNOTATION_ON_PACKAGE : + if (this.formatter.preferences.insert_new_line_after_annotation_on_package) { shouldAddNewLine = true; } break; @@ -4508,17 +4543,66 @@ public class Scribe implements IJavaDocTagConstants { currentTokenStartPosition = this.scanner.currentPosition; break; case TerminalTokens.TokenNameCOMMENT_BLOCK : - printBlockComment(false); - currentTokenStartPosition = this.scanner.currentPosition; - hasComment = true; - break; case TerminalTokens.TokenNameCOMMENT_JAVADOC : - printBlockComment(true); + if (this.useTags && this.editsEnabled) { + boolean turnOff = false; + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + turnOff = true; + } else if (this.tagsKind == this.currentToken + && CharOperation.equals(this.disablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition+1)) { + this.editsEnabled = false; + turnOff = true; + } + if (turnOff) { + if (!this.editsEnabled && this.editsIndex > 1) { + OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1]; + if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) { + printNewLinesBeforeDisablingComment(); + } + } + } + } + printBlockComment(this.currentToken == TerminalTokens.TokenNameCOMMENT_JAVADOC); + if (this.useTags && !this.editsEnabled) { + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + } else if (this.tagsKind == this.currentToken) { + this.editsEnabled = CharOperation.equals(this.enablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition+1); + } + } currentTokenStartPosition = this.scanner.currentPosition; hasComment = true; break; case TerminalTokens.TokenNameCOMMENT_LINE : + tokenEndPosition = -this.scanner.commentStops[this.scanner.commentPtr]; + if (this.useTags && this.editsEnabled) { + boolean turnOff = false; + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + turnOff = true; + } else if (this.tagsKind == this.currentToken + && CharOperation.equals(this.disablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition)) { + this.editsEnabled = false; + turnOff = true; + } + if (turnOff) { + if (!this.editsEnabled && this.editsIndex > 1) { + OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1]; + if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) { + printNewLinesBeforeDisablingComment(); + } + } + } + } printLineComment(); + if (this.useTags && !this.editsEnabled) { + if (foundTaskCount > 0) { + setEditsEnabled(foundTaskCount); + } else if (this.tagsKind == this.currentToken) { + this.editsEnabled = CharOperation.equals(this.enablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition); + } + } currentTokenStartPosition = this.scanner.currentPosition; break; case TerminalTokens.TokenNameWHITESPACE : @@ -4974,8 +5058,8 @@ public class Scribe implements IJavaDocTagConstants { * disabling/enabling tags in a comment, hence the last one will be the one really * changing the formatter behavior... */ - private void setEditsEnabled(int count, int previous) { - for (int i=previous; i<count; i++) { + private void setEditsEnabled(int count) { + for (int i=0; i<count; i++) { if (this.disablingTag != null && CharOperation.equals(this.scanner.foundTaskTags[i], this.disablingTag)) { this.editsEnabled = false; } diff --git a/org.eclipse.jdt.core/grammar/otj.g b/org.eclipse.jdt.core/grammar/otj.g index 60f7e0af2..aafde922f 100644 --- a/org.eclipse.jdt.core/grammar/otj.g +++ b/org.eclipse.jdt.core/grammar/otj.g @@ -396,7 +396,6 @@ InternalCompilationUnit ::= $empty /.$putCase consumeEmptyInternalCompilationUnit(); $break ./ /:$readableName CompilationUnit:/ - ReduceImports ::= $empty /.$putCase consumeReduceImports(); $break ./ /:$readableName ReduceImports:/ @@ -1247,8 +1246,15 @@ InvalidConstructorDeclaration ::= ConstructorHeader ';' /.$putCase consumeInvalidConstructorDeclaration(false); $break ./ /:$readableName InvalidConstructorDeclaration:/ +-- These rules are added to be able to parse initializers inside an interface and then report a relevent error message (bug 212713) +InvalidInitializer -> StaticInitializer +InvalidInitializer -> Initializer +/:$readableName InvalidInitializer:/ + + InterfaceMemberDeclaration -> AbstractMethodDeclaration InterfaceMemberDeclaration -> InvalidConstructorDeclaration +InterfaceMemberDeclaration -> InvalidInitializer --1.1 feature InterfaceMemberDeclaration -> ClassDeclaration --1.1 feature diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java index 8edcfbb80..ce066236d 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -56,19 +56,6 @@ public interface IAnnotation extends IJavaElement, ISourceReference { IMemberValuePair[] getMemberValuePairs() throws JavaModelException; /** - * Returns the source range of this annotation's name, - * or <code>null</code> if this annotation does not have - * associated source code (for example, in a binary type). - * - * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. - * @return the source range of this annotation's name, - * or <code>null</code> if this annotation does not have - * associated source code (for example, in a binary type) - */ - ISourceRange getNameRange() throws JavaModelException; - - /** * Returns the position relative to the order this annotation is defined in the source. * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0). * <p> diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IBuffer.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IBuffer.java index ed9eb4838..9cebaa27b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IBuffer.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IBuffer.java @@ -196,7 +196,7 @@ public boolean isClosed(); public boolean isReadOnly(); /** * Removes the given listener from this buffer. - * Has no affect if an identical listener is not registered or if the buffer is closed. + * Has no effect if an identical listener is not registered or if the buffer is closed. * * @param listener the listener */ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java index aff98fda0..1a66dd452 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java @@ -160,7 +160,7 @@ void becomeWorkingCopy(IProgressMonitor monitor) throws JavaModelException; * * <p>It is possible that the contents of the original resource have changed * since this working copy was created, in which case there is an update conflict. - * The value of the <code>force</code> parameter effects the resolution of + * The value of the <code>force</code> parameter affects the resolution of * such a conflict:<ul> * <li> <code>true</code> - in this case the contents of this working copy are applied to * the underlying resource even though this working copy was created before @@ -280,7 +280,7 @@ IImportDeclaration createImport(String name, IJavaElement sibling, int flags, IP * to the end of this compilation unit. * * <p>It is possible that a type with the same name already exists in this compilation unit. - * The value of the <code>force</code> parameter effects the resolution of + * The value of the <code>force</code> parameter affects the resolution of * such a conflict:<ul> * <li> <code>true</code> - in this case the type is created with the new contents</li> * <li> <code>false</code> - in this case a {@link JavaModelException} is thrown</li> diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IImportDeclaration.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IImportDeclaration.java index 15fa87f6a..789279f68 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IImportDeclaration.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IImportDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -39,7 +39,6 @@ String getElementName(); * @since 3.0 */ int getFlags() throws JavaModelException; - /** * Returns whether the import is on-demand. An import is on-demand if it ends * with <code>".*"</code>. diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ILocalVariable.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ILocalVariable.java index 45c21f4ad..eb4735198 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ILocalVariable.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ILocalVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -52,4 +52,46 @@ public interface ILocalVariable extends IJavaElement, ISourceReference, IAnnotat * @see Signature */ String getTypeSignature(); + + /** + * Returns <code>true</code> if this local variable is a method parameter, <code>false</code> otherwise. + * + * @return <code>true</code> if this local variable is a method parameter, <code>false</code> otherwise + * @since 3.7 + */ + boolean isParameter(); + + /** + * Returns the modifier flags for this local variable. The flags can be examined using class + * {@link Flags}. + * + * <p>Note that only flags as indicated in the source are returned.</p> + * + * @return the modifier flags for this local variable + * @see Flags + * @since 3.7 + */ + int getFlags(); + + /** + * Returns the declaring member of this local variable. + * <p> + * This is a handle-only method. + * </p> + * + * @return the declaring member of this local variable + * @since 3.7 + */ + IMember getDeclaringMember(); + + /** + * Returns the Java type root in which this local variable is declared. + * <p> + * This is a handle-only method. + * </p> + * + * @return the Java type root in which this local variable is declared + * @since 3.7 + */ + ITypeRoot getTypeRoot(); } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMember.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMember.java index 14f2ecbbb..69c943a88 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMember.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMember.java @@ -93,20 +93,6 @@ int getFlags() throws JavaModelException; */ ISourceRange getJavadocRange() throws JavaModelException; /** - * Returns the source range of this member's simple name, - * or <code>null</code> if this member does not have a name - * (for example, an initializer), or if this member does not have - * associated source code (for example, a binary type). - * - * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. - * @return the source range of this member's simple name, - * or <code>null</code> if this member does not have a name - * (for example, an initializer), or if this member does not have - * associated source code (for example, a binary type) - */ -ISourceRange getNameRange() throws JavaModelException; -/** * Returns the position relative to the order this member is defined in the source. * Numbering starts at 1 (thus the first occurrence is occurrence 1, not occurrence 0). * <p> diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageDeclaration.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageDeclaration.java index 5aff30ac1..2f394d77e 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageDeclaration.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragment.java index 3dcb3b845..4c075b2d8 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragment.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragment.java @@ -49,7 +49,7 @@ public interface IPackageFragment extends IParent, IJavaElement, IOpenable, ISou * * <p>It is possible that a compilation unit with the same name already exists in this * package fragment. - * The value of the <code>force</code> parameter effects the resolution of + * The value of the <code>force</code> parameter affects the resolution of * such a conflict:<ul> * <li> <code>true</code> - in this case the compilation is created with the new contents</li> * <li> <code>false</code> - in this case a <code>JavaModelException</code> is thrown</li> diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ISourceReference.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ISourceReference.java index f88fa8305..f9f045eff 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ISourceReference.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ISourceReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -72,4 +72,42 @@ String getSource() throws JavaModelException; * @see SourceRange#isAvailable(ISourceRange) */ ISourceRange getSourceRange() throws JavaModelException; + +/** + * Returns the name range associated with this element. + * + * <p>If the element is an {@link IMember}, it returns + * the source range of this member's simple name, + * or <code>null</code> if this member does not have a name + * (for example, an initializer), or if this member does not have + * associated source code (for example, a binary type).</p> + * + * <p>If this element is an {@link IImportDeclaration}, the source range + * of this import declaration's name, or <code>null</code> if this import + * declaration does not have associated source code (for example, a binary type). + * <br>The source range for the name includes the trailing '*' if the call to + * {@link IImportDeclaration#isOnDemand()} returns true. + * </p> + * + * <p>If this element is an {@link IPackageDeclaration}, the source range of + * this package declaration's name, or <code>null</code> if this package + * declaration does not have associated source code (for example, a binary type).</p> + * + * <p>If this element is an {@link IAnnotation}, the source range of + * this annotation's name, or <code>null</code> if this annotation does not have + * associated source code (for example, in a binary type).</p> + * + * <p>If this element is an {@link ITypeParameter}, the source range of this + * type parameter's name, or <code>null</code> if this type parameter does not have + * associated source code (for example, in a binary type).</p> + * + * <p>If this element is an {@link ITypeRoot} or {@link IImportContainer}, it + * returns null.</p> + * + * @return the name range associated with this element, or <code>null</code> if + * not available + * + * @since 3.7 + */ +ISourceRange getNameRange() throws JavaModelException; } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java index cd489e64a..d843d6160 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java @@ -335,7 +335,7 @@ public interface IType extends IMember, IAnnotatable { * as the last field declaration in this type.</p> * * <p>It is possible that a field with the same name already exists in this type. - * The value of the <code>force</code> parameter effects the resolution of + * The value of the <code>force</code> parameter affects the resolution of * such a conflict:<ul> * <li> <code>true</code> - in this case the field is created with the new contents</li> * <li> <code>false</code> - in this case a <code>JavaModelException</code> is thrown</li> @@ -393,7 +393,7 @@ public interface IType extends IMember, IAnnotatable { * to this type. * * <p>It is possible that a method with the same signature already exists in this type. - * The value of the <code>force</code> parameter effects the resolution of + * The value of the <code>force</code> parameter affects the resolution of * such a conflict:<ul> * <li> <code>true</code> - in this case the method is created with the new contents</li> * <li> <code>false</code> - in this case a <code>JavaModelException</code> is thrown</li> @@ -427,7 +427,7 @@ public interface IType extends IMember, IAnnotatable { * to this type.</p> * * <p>It is possible that a type with the same name already exists in this type. - * The value of the <code>force</code> parameter effects the resolution of + * The value of the <code>force</code> parameter affects the resolution of * such a conflict:<ul> * <li> <code>true</code> - in this case the type is created with the new contents</li> * <li> <code>false</code> - in this case a <code>JavaModelException</code> is thrown</li> diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeHierarchy.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeHierarchy.java index 5e879df2e..59d37a44f 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeHierarchy.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeHierarchy.java @@ -277,7 +277,7 @@ IType getType(); void refresh(IProgressMonitor monitor) throws JavaModelException; /** * Removes the given listener from this type hierarchy. - * Has no affect if an identical listener is not registered. + * Has no effect if an identical listener is not registered. * * @param listener the listener */ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java index 2411a3669..3fe8d1b3b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java @@ -68,15 +68,13 @@ public interface ITypeParameter extends IJavaElement, ISourceReference { IMember getDeclaringMember(); /** - * Returns the source range of this type parameter's name, - * or <code>null</code> if this type parameter does not have - * associated source code (for example, in a binary type). + * Returns the Java type root in which this type parameter is declared. + * <p> + * This is a handle-only method. + * </p> * - * @exception JavaModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource. - * @return the source range of this type parameter's name, - * or <code>null</code> if this type parameter does not have - * associated source code (for example, in a binary type) + * @return the Java type root in which this type parameter is declared + * @since 3.7 */ - ISourceRange getNameRange() throws JavaModelException; + ITypeRoot getTypeRoot(); } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IWorkingCopy.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IWorkingCopy.java index aac30a227..f2961e791 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IWorkingCopy.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IWorkingCopy.java @@ -59,7 +59,7 @@ public interface IWorkingCopy { * * <p>It is possible that the contents of the original resource have changed * since this working copy was created, in which case there is an update conflict. - * The value of the <code>force</code> parameter effects the resolution of + * The value of the <code>force</code> parameter affects the resolution of * such a conflict:<ul> * <li> <code>true</code> - in this case the contents of this working copy are applied to * the underlying resource even though this working copy was created before diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java index 57730b12d..0ded9c277 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java @@ -4697,7 +4697,7 @@ public final class JavaCore extends Plugin { /** * Removes the given element changed listener. - * Has no affect if an identical listener is not registered. + * Has no effect if an identical listener is not registered. * * @param listener the listener */ @@ -4721,7 +4721,7 @@ public final class JavaCore extends Plugin { /** * Removes the given pre-processing resource changed listener. * <p> - * Has no affect if an identical listener is not registered. + * Has no effect if an identical listener is not registered. * * @param listener the listener * @since 3.0 diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java index 83344aeda..a8254fff8 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -135,6 +135,12 @@ public interface ISourceElementRequestor { * @param declarationEnd * This is the position of the ';' ending the import statement or * the end of the comment following the import. + * @param nameStart + * This is the position of the first character of the import declaration's + * name. + * @param nameEnd + * This is the position of the last character of the import declaration's + * name. * @param tokens * This are the tokens of the import like specified in the source. * @param onDemand @@ -143,7 +149,7 @@ public interface ISourceElementRequestor { * @param modifiers * can be set to static from 1.5 on. */ - void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers); + void acceptImport(int declarationStart, int declarationEnd, int nameStart, int nameEnd, char[][] tokens, boolean onDemand, int modifiers); /* * Table of line separator position. This table is passed once at the end of diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java index 2a97bf4ca..161fe78fd 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 IBM Corporation and others. + * Copyright (c) 2008, 2010 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 @@ -805,11 +805,14 @@ protected void notifySourceElementRequestor( if (isPackage) { this.requestor.acceptPackage(importReference); } else { + final boolean onDemand = (importReference.bits & ASTNode.OnDemand) != 0; this.requestor.acceptImport( importReference.declarationSourceStart, importReference.declarationSourceEnd, + importReference.sourceStart, + onDemand ? importReference.trailingStarPosition : importReference.sourceEnd, importReference.tokens, - (importReference.bits & ASTNode.OnDemand) != 0, + onDemand, importReference.modifiers); } } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java index 37f3a6dd0..b0b4f8873 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -721,6 +721,8 @@ protected void consumeStaticImportOnDemandDeclarationName() { System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccStatic)); + // star end position + impt.trailingStarPosition = this.intStack[this.intPtr--]; this.modifiers = ClassFileConstants.AccDefault; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) @@ -765,6 +767,8 @@ protected void consumeTypeImportOnDemandDeclarationName() { System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccDefault)); + // star end position + impt.trailingStarPosition = this.intStack[this.intPtr--]; if (this.currentToken == TokenNameSEMICOLON){ impt.declarationSourceEnd = this.scanner.currentPosition - 1; } else { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java index 3bb8ac31f..48ead6c38 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -54,11 +54,13 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor { } /** - * @see ISourceElementRequestor#acceptImport(int, int, char[][], boolean, int) + * @see ISourceElementRequestor#acceptImport(int, int, int, int, char[][], boolean, int) */ public void acceptImport( int declarationStart, int declarationEnd, + int nameStart, + int nameEnd, char[][] tokens, boolean onDemand, int modifiers) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java index f781e16f4..4e772048d 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - TypeConverters don't set enclosingType - https://bugs.eclipse.org/bugs/show_bug.cgi?id=320841 * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -321,7 +322,9 @@ public class SourceTypeConverter extends TypeConverter { // convert 1.5 specific constructs only if compliance is 1.5 or above TypeParameter[] typeParams = null; - if (this.has1_5Compliance) { + // Digest type parameters if compliance level of current project or its prerequisite is >= 1.5 + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 && https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 + if (this.has1_5Compliance || this.problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5) { /* convert type parameters */ char[][] typeParameterNames = methodInfo.getTypeParameterNames(); if (typeParameterNames != null) { @@ -512,7 +515,10 @@ public class SourceTypeConverter extends TypeConverter { if (this.has1_5Compliance) { /* convert annotations */ type.annotations = convertAnnotations(typeHandle); - + } + // Digest type parameters if compliance level of current project or its prerequisite is >= 1.5 + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633 && https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259 + if (this.has1_5Compliance || this.problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5) { /* convert type parameters */ char[][] typeParameterNames = typeInfo.getTypeParameterNames(); if (typeParameterNames.length > 0) { @@ -593,9 +599,7 @@ public class SourceTypeConverter extends TypeConverter { type.memberTypes = new TypeDeclaration[sourceMemberTypeCount]; for (int i = 0; i < sourceMemberTypeCount; i++) { type.memberTypes[i] = convert(sourceMemberTypes[i], compilationResult); -//{ObjectTeams: fix for Bug 320841 - TypeConverters don't set enclosingType - type.memberTypes[i].enclosingType = type; -// SH} + type.memberTypes[i].enclosingType = type; } } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java index f075a629a..05b0cd0cc 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. + * Copyright (c) 2008, 2010 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 @@ -67,7 +67,7 @@ public abstract class TypeConverter { protected TypeConverter(ProblemReporter problemReporter, char memberTypeSeparator) { this.problemReporter = problemReporter; - this.has1_5Compliance = problemReporter.options.complianceLevel >= ClassFileConstants.JDK1_5; + this.has1_5Compliance = problemReporter.options.originalComplianceLevel >= ClassFileConstants.JDK1_5; this.memberTypeSeparator = memberTypeSeparator; } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AnnotatableInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AnnotatableInfo.java index 0dfc6f4b3..0ee1ce1ca 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AnnotatableInfo.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AnnotatableInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -11,6 +11,8 @@ package org.eclipse.jdt.internal.core; import org.eclipse.jdt.core.IAnnotation; +import org.eclipse.jdt.core.ISourceRange; +import org.eclipse.jdt.core.SourceRange; public class AnnotatableInfo extends MemberElementInfo { @@ -61,4 +63,7 @@ public class AnnotatableInfo extends MemberElementInfo { protected void setNameSourceStart(int start) { this.nameStart= start; } + protected ISourceRange getNameRange() { + return new SourceRange(this.nameStart, this.nameEnd - this.nameStart + 1); + } } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java index 30ec4b371..d2d891aa5 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -181,7 +181,17 @@ public String[] getParameterNames() throws JavaModelException { // try to see if we can retrieve the names from the attached javadoc IBinaryMethod info = (IBinaryMethod) getElementInfo(); - final int paramCount = Signature.getParameterCount(new String(info.getMethodDescriptor())); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316937 + // Use Signature#getParameterCount() only if the argument names are not already available. + int paramCount = Signature.getParameterCount(new String(info.getMethodDescriptor())); + if (this.isConstructor()) { + final IType declaringType = this.getDeclaringType(); + if (declaringType.isMember() + && !Flags.isStatic(declaringType.getFlags())) { + paramCount--; // remove synthetic argument from constructor param count + } + } + if (paramCount != 0) { // don't try to look for javadoc for synthetic methods int modifiers = getFlags(); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java index 6883c2914..a0ec5741a 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -8,6 +8,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - TypeConverters don't set enclosingType - https://bugs.eclipse.org/bugs/show_bug.cgi?id=320841 * Fraunhofer FIRST - extended API and implementation * Technical University Berlin - extended API and implementation *******************************************************************************/ @@ -338,10 +339,8 @@ public class BinaryTypeConverter extends TypeConverter { typeDeclaration.memberTypes[i] = alreadyComputedMemberDeclaration; } else { typeDeclaration.memberTypes[i] = convert(memberTypes[i], null, null); -//{ObjectTeams: fix for Bug 320841 - TypeConverters don't set enclosingType - typeDeclaration.memberTypes[i].enclosingType = typeDeclaration; -// SH} } + typeDeclaration.memberTypes[i].enclosingType = typeDeclaration; } /* convert fields */ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java index c69893b86..b1ac5e051 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java @@ -19,7 +19,7 @@ import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; -public class CancelableNameEnvironment extends SearchableEnvironment implements INameEnviromentWithProgress { +public class CancelableNameEnvironment extends SearchableEnvironment implements INameEnvironmentWithProgress { private IProgressMonitor monitor; public CancelableNameEnvironment(JavaProject project, WorkingCopyOwner owner, IProgressMonitor monitor) throws JavaModelException { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java index 9efc540f4..4be1c0402 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -861,4 +861,7 @@ protected IStatus validateExistence(IResource underlyingResource) { } return JavaModelStatus.VERIFIED_OK; } +public ISourceRange getNameRange() { + return null; +} } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java index 950aaf884..ea82d0f74 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java @@ -355,12 +355,39 @@ private void generateMethodInfos(IType type, IBinaryType typeInfo, HashMap newEl // TODO (jerome) filter out synthetic members // indexer should not index them as well // if ((methodInfo.getModifiers() & IConstants.AccSynthetic) != 0) continue; // skip synthetic + boolean useGenericSignature = true; char[] signature = methodInfo.getGenericSignature(); - if (signature == null) signature = methodInfo.getMethodDescriptor(); + if (signature == null) { + useGenericSignature = false; + signature = methodInfo.getMethodDescriptor(); + } + String selector = new String(methodInfo.getSelector()); + final boolean isConstructor = methodInfo.isConstructor(); + if (isConstructor) { + selector = type.getElementName(); +//{ObjectTeams: role constructor? + if (selector.startsWith(IOTConstants.OT_DELIM)) + selector = selector.substring(IOTConstants.OT_DELIM_LEN); +// SH} + } String[] pNames = null; try { pNames = Signature.getParameterTypes(new String(signature)); - } catch (IllegalArgumentException e) { + if (isConstructor + && useGenericSignature + && type.isMember() + && !Flags.isStatic(type.getFlags())) { + int length = pNames.length; + System.arraycopy(pNames, 0, (pNames = new String[length + 1]), 1, length); + char[] descriptor = methodInfo.getMethodDescriptor(); + final String[] parameterTypes = Signature.getParameterTypes(new String(descriptor)); + pNames[0] = parameterTypes[0]; + } + }catch (IllegalArgumentException e) { + // protect against malformed .class file (e.g. com/sun/crypto/provider/SunJCE_b.class has a 'a' generic signature) + signature = methodInfo.getMethodDescriptor(); + pNames = Signature.getParameterTypes(new String(signature)); + } catch (JavaModelException e) { // protect against malformed .class file (e.g. com/sun/crypto/provider/SunJCE_b.class has a 'a' generic signature) signature = methodInfo.getMethodDescriptor(); pNames = Signature.getParameterTypes(new String(signature)); @@ -371,14 +398,6 @@ private void generateMethodInfos(IType type, IBinaryType typeInfo, HashMap newEl } char[][] parameterTypes = ClassFile.translatedNames(paramNames); JavaModelManager manager = JavaModelManager.getJavaModelManager(); - String selector = new String(methodInfo.getSelector()); - if (methodInfo.isConstructor()) { - selector =type.getElementName(); -//{ObjectTeams: role constructor? - if (selector.startsWith(IOTConstants.OT_DELIM)) - selector = selector.substring(IOTConstants.OT_DELIM_LEN); -// SH} - } selector = manager.intern(selector); for (int j= 0; j < pNames.length; j++) { pNames[j]= manager.intern(new String(parameterTypes[j])); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java index cd3c7bab7..5c12f6ed6 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java @@ -1364,4 +1364,7 @@ protected IStatus validateExistence(IResource underlyingResource) { return JavaModelStatus.VERIFIED_OK; } +public ISourceRange getNameRange() { + return null; +} } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java index 5cf7ac7c6..f2b617350 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java @@ -105,34 +105,47 @@ public class CompilationUnitProblemFinder extends Compiler { CompilationResult result = new CompilationResult(sourceTypes[0].getFileName(), 1, 1, this.options.maxProblemsPerUnit); + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=305259, build the compilation unit in its own sand box. + final long savedComplianceLevel = this.options.complianceLevel; + final long savedSourceLevel = this.options.sourceLevel; + + try { + IJavaProject project = ((SourceTypeElementInfo) sourceTypes[0]).getHandle().getJavaProject(); + this.options.complianceLevel = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_COMPLIANCE, true)); + this.options.sourceLevel = CompilerOptions.versionToJdkLevel(project.getOption(JavaCore.COMPILER_SOURCE, true)); - // need to hold onto this - CompilationUnitDeclaration unit = - SourceTypeConverter.buildCompilationUnit( - sourceTypes,//sourceTypes[0] is always toplevel here - SourceTypeConverter.FIELD_AND_METHOD // need field and methods - | SourceTypeConverter.MEMBER_TYPE // need member types - | SourceTypeConverter.FIELD_INITIALIZATION, // need field initialization - this.lookupEnvironment.problemReporter, - result); + // need to hold onto this + CompilationUnitDeclaration unit = + SourceTypeConverter.buildCompilationUnit( + sourceTypes,//sourceTypes[0] is always toplevel here + SourceTypeConverter.FIELD_AND_METHOD // need field and methods + | SourceTypeConverter.MEMBER_TYPE // need member types + | SourceTypeConverter.FIELD_INITIALIZATION, // need field initialization + this.lookupEnvironment.problemReporter, + result); - if (unit != null) { + if (unit != null) { //{ObjectTeams: controlled by Dependencies: - boolean newDependencySetup= false; - try { - if (!Dependencies.isSetup()) { - newDependencySetup= true; - Dependencies.setup(this, this.parser, this.lookupEnvironment, true, false); - } + boolean newDependencySetup= false; + try { + if (!Dependencies.isSetup()) { + newDependencySetup= true; + Dependencies.setup(this, this.parser, this.lookupEnvironment, true, false); + } // orig: Note(SH): this will redirect: - this.lookupEnvironment.buildTypeBindings(unit, accessRestriction); - this.lookupEnvironment.completeTypeBindings(unit); -// :giro - } finally { - if (newDependencySetup) - Dependencies.release(this); - } + this.lookupEnvironment.buildTypeBindings(unit, accessRestriction); + this.lookupEnvironment.completeTypeBindings(unit); +// :giro + } finally { + if (newDependencySetup) + Dependencies.release(this); + } // SH} + } + } finally { + this.options.complianceLevel = savedComplianceLevel; + this.options.sourceLevel = savedSourceLevel; } } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java index 8949b340d..9e89ccb16 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -140,7 +140,7 @@ protected CompilationUnitStructureRequestor(ICompilationUnit unit, CompilationUn /** * @see ISourceElementRequestor */ -public void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers) { +public void acceptImport(int declarationStart, int declarationEnd, int nameSourceStart, int nameSourceEnd, char[][] tokens, boolean onDemand, int modifiers) { JavaElement parentHandle= (JavaElement) this.handleStack.peek(); if (!(parentHandle.getElementType() == IJavaElement.COMPILATION_UNIT)) { Assert.isTrue(false); // Should not happen @@ -163,6 +163,8 @@ public void acceptImport(int declarationStart, int declarationEnd, char[][] toke ImportDeclarationElementInfo info = new ImportDeclarationElementInfo(); info.setSourceRangeStart(declarationStart); info.setSourceRangeEnd(declarationEnd); + info.setNameSourceStart(nameSourceStart); + info.setNameSourceEnd(nameSourceEnd); info.setFlags(modifiers); addToChildren(this.importContainerInfo, handle); @@ -201,6 +203,8 @@ public void acceptPackage(ImportReference importReference) { AnnotatableInfo info = new AnnotatableInfo(); info.setSourceRangeStart(importReference.declarationSourceStart); info.setSourceRangeEnd(importReference.declarationSourceEnd); + info.setNameSourceStart(importReference.sourceStart); + info.setNameSourceEnd(importReference.sourceEnd); addToChildren(parentInfo, handle); this.newElements.put(handle, info); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFolderChange.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFolderChange.java index 916d346d6..2614cc16e 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFolderChange.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFolderChange.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - inconsistent initialization of classpath container backed by external class folder, see https://bugs.eclipse.org/320618 *******************************************************************************/ package org.eclipse.jdt.internal.core; @@ -42,7 +43,7 @@ public class ExternalFolderChange { Iterator iterator = newFolders.iterator(); while (iterator.hasNext()) { Object folderPath = iterator.next(); - if (oldFolders == null || !oldFolders.remove(folderPath) || foldersManager.isPendingFolder(folderPath)) { + if (oldFolders == null || !oldFolders.remove(folderPath) || foldersManager.removePendingFolder(folderPath)) { try { foldersManager.createLinkFolder((IPath) folderPath, refreshIfExistAlready, monitor); } catch (CoreException e) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java index f3396616b..9fffd725b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - inconsistent initialization of classpath container backed by external class folder, see https://bugs.eclipse.org/320618 *******************************************************************************/ package org.eclipse.jdt.internal.core; @@ -14,12 +15,14 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.Vector; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; @@ -124,7 +127,12 @@ public class ExternalFoldersManager { return result; } - public boolean isPendingFolder(Object externalPath) { + /** + * Try to remove the argument from the list of folders pending for creation. + * @param externalPath to link to + * @return true if the argument was found in the list of pending folders and could be removed from it. + */ + public boolean removePendingFolder(Object externalPath) { if (this.pendingFolders == null) return false; return this.pendingFolders.remove(externalPath); @@ -145,18 +153,11 @@ public class ExternalFoldersManager { if (toDelete == null) return; for (Iterator iterator = toDelete.iterator(); iterator.hasNext();) { - IFolder folder = (IFolder) iterator.next(); + Map.Entry entry = (Map.Entry) iterator.next(); + IFolder folder = (IFolder) entry.getValue(); folder.delete(true, monitor); - IPath key = null; - for (Iterator knownIt = this.folders.entrySet().iterator(); knownIt.hasNext();) { - Map.Entry entry = (Map.Entry)knownIt.next(); - if (entry.getValue().equals(folder)) { - key = (IPath)entry.getKey(); - break; - } - } - if (key != null) - this.folders.remove(key); + IPath key = (IPath) entry.getKey(); + this.folders.remove(key); } IProject project = getExternalFoldersProject(); if (project.isAccessible() && project.members().length == 1/*remaining member is .project*/) @@ -178,11 +179,10 @@ public class ExternalFoldersManager { IPath path = (IPath) entry.getKey(); if ((roots != null && !roots.containsKey(path)) && (sourceAttachments != null && !sourceAttachments.containsKey(path))) { - IFolder folder = (IFolder) entry.getValue(); - if (folder != null) { + if (entry.getValue() != null) { if (result == null) result = new ArrayList(); - result.add(folder); + result.add(entry); } } } @@ -291,7 +291,30 @@ public class ExternalFoldersManager { } return this.folders; } - + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=313153 + // Use the same RefreshJob if the job is still available + private void runRefreshJob(Collection paths) { + Job[] jobs = Job.getJobManager().find(ResourcesPlugin.FAMILY_MANUAL_REFRESH); + RefreshJob refreshJob = null; + if (jobs != null) { + for (int index = 0; index < jobs.length; index++) { + // We are only concerned about ExternalFolderManager.RefreshJob + if(jobs[index] instanceof RefreshJob) { + refreshJob = (RefreshJob) jobs[index]; + refreshJob.addFoldersToRefresh(paths); + if (refreshJob.getState() == Job.NONE) { + refreshJob.schedule(); + } + break; + } + } + } + if (refreshJob == null) { + refreshJob = new RefreshJob(new Vector(paths)); + refreshJob.schedule(); + } + } /* * Refreshes the external folders referenced on the classpath of the given source project */ @@ -317,9 +340,8 @@ public class ExternalFoldersManager { if (externalFolders == null) return; - Iterator iterator = externalFolders.iterator(); - Job refreshJob = new RefreshJob(iterator); - refreshJob.schedule(); + runRefreshJob(externalFolders); + } catch (CoreException e) { Util.log(e, "Exception while refreshing external project"); //$NON-NLS-1$ } @@ -335,10 +357,8 @@ public class ExternalFoldersManager { HashSet externalFolders = getExternalFolders(((JavaProject) JavaCore.create(source)).getResolvedClasspath()); if (externalFolders == null) return; - Iterator iterator = externalFolders.iterator(); - Job refreshJob = new RefreshJob(iterator); - refreshJob.schedule(); + runRefreshJob(externalFolders); } catch (CoreException e) { Util.log(e, "Exception while refreshing external project"); //$NON-NLS-1$ } @@ -350,8 +370,8 @@ public class ExternalFoldersManager { } class RefreshJob extends Job { - Iterator externalFolders = null; - RefreshJob(Iterator externalFolders){ + Vector externalFolders = null; + RefreshJob(Vector externalFolders){ super(Messages.refreshing_external_folders); this.externalFolders = externalFolders; } @@ -360,14 +380,40 @@ public class ExternalFoldersManager { return family == ResourcesPlugin.FAMILY_MANUAL_REFRESH; } + /* + * Add the collection of paths to be refreshed to the already + * existing list of paths. + */ + public void addFoldersToRefresh(Collection paths) { + if (!paths.isEmpty() && this.externalFolders == null) { + this.externalFolders = new Vector(); + } + Iterator it = paths.iterator(); + while(it.hasNext()) { + Object path = it.next(); + if (!this.externalFolders.contains(path)) { + this.externalFolders.add(path); + } + } + } + protected IStatus run(IProgressMonitor pm) { try { - while (this.externalFolders.hasNext()) { - IPath externalPath = (IPath) this.externalFolders.next(); - IFolder folder = getFolder(externalPath); - if (folder != null) { - folder.refreshLocal(IResource.DEPTH_INFINITE, pm); + if (this.externalFolders == null) + return Status.OK_STATUS; + IPath externalPath = null; + for (int index = 0; index < this.externalFolders.size(); index++ ) { + if ((externalPath = (IPath)this.externalFolders.get(index)) != null) { + IFolder folder = getFolder(externalPath); + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321358 + if (folder != null) + folder.refreshLocal(IResource.DEPTH_INFINITE, pm); } + // Set the processed ones to null instead of removing the element altogether, + // so that they will not be considered as duplicates. + // This will also avoid elements being shifted to the left every time an element + // is removed. However, there is a risk of Collection size to be increased more often. + this.externalFolders.setElementAt(null, index); } } catch (CoreException e) { return e.getStatus(); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnviromentWithProgress.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnvironmentWithProgress.java index 45e13bc3b..82e1770be 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnviromentWithProgress.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnvironmentWithProgress.java @@ -24,7 +24,7 @@ import org.eclipse.jdt.internal.compiler.env.INameEnvironment; * * @since 3.6 */ -public interface INameEnviromentWithProgress extends INameEnvironment { +public interface INameEnvironmentWithProgress extends INameEnvironment { /** * Set the monitor for the given name environment. In order to be able to cancel this name environment calls, diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportContainer.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportContainer.java index cf33848d9..c1cf002c9 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportContainer.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportContainer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -114,4 +114,7 @@ protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean s buffer.append(" (not open)"); //$NON-NLS-1$ } } +public ISourceRange getNameRange() { + return null; +} } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclaration.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclaration.java index 1e1ac5d62..c85bf1266 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclaration.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -77,6 +77,10 @@ protected char getHandleMementoDelimiter() { Assert.isTrue(false, "Should not be called"); //$NON-NLS-1$ return 0; } +public ISourceRange getNameRange() throws JavaModelException { + ImportDeclarationElementInfo info = (ImportDeclarationElementInfo) getElementInfo(); + return info.getNameRange(); +} /* * @see JavaElement#getPrimaryElement(boolean) */ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclarationElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclarationElementInfo.java index e1873e417..4ae68edb6 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclarationElementInfo.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclarationElementInfo.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.jdt.internal.core; +import org.eclipse.jdt.core.ISourceRange; +import org.eclipse.jdt.core.SourceRange; import org.eclipse.jdt.internal.compiler.env.ISourceImport; /** @@ -18,5 +20,34 @@ import org.eclipse.jdt.internal.compiler.env.ISourceImport; */ public class ImportDeclarationElementInfo extends MemberElementInfo implements ISourceImport{ - // empty element info + /** + * The start position of this import declaration's name in the its + * openable's buffer. + */ + protected int nameStart= -1; + + /** + * The last position of this import declaration's name in the its + * openable's buffer. + */ + protected int nameEnd= -1; + + /** + * Sets the last position of this import declaration's name, relative + * to its openable's source buffer. + */ + protected void setNameSourceEnd(int end) { + this.nameEnd= end; + } + /** + * Sets the start position of this import declaration's name, relative + * to its openable's source buffer. + */ + protected void setNameSourceStart(int start) { + this.nameStart= start; + } + + protected ISourceRange getNameRange() { + return new SourceRange(this.nameStart, this.nameEnd - this.nameStart + 1); + } } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java index f21e86541..3c0239a6d 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java @@ -76,7 +76,7 @@ import org.xml.sax.SAXException; /** * <h4>OTDT changes:</h4> * <dl> - * <dt>What:<dd> respect IOTJavaElement which cannot be casted to JavaElement + * <dt>What:<dd> Filter IProblem.AdaptedPluginAccess when saving state. * </dl> * <hr> * The <code>JavaModelManager</code> manages instances of <code>IJavaModel</code>. @@ -1003,9 +1003,8 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis JavaProjectElementInfo projectInfo = (JavaProjectElementInfo) getJavaModelManager().getInfo(project); ProjectCache projectCache = projectInfo == null ? null : projectInfo.projectCache; HashtableOfArrayToObject allPkgFragmentsCache = projectCache == null ? null : projectCache.allPkgFragmentsCache; - IClasspathEntry[] entries = - org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(resourcePath.lastSegment()) - ? project.getRawClasspath() // JAVA file can only live inside SRC folder (on the raw path) + boolean isJavaLike = org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(resourcePath.lastSegment()); + IClasspathEntry[] entries = isJavaLike ? project.getRawClasspath() // JAVA file can only live inside SRC folder (on the raw path) : ((JavaProject)project).getResolvedClasspath(); int length = entries.length; @@ -1017,6 +1016,8 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) continue; IPath rootPath = entry.getPath(); if (rootPath.equals(resourcePath)) { + if (isJavaLike) + return null; return project.getPackageFragmentRoot(resource); } else if (rootPath.isPrefixOf(resourcePath)) { // allow creation of package fragment if it contains a .java file that is included @@ -1408,6 +1409,8 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis public static boolean CP_RESOLVE_VERBOSE_ADVANCED = false; public static boolean CP_RESOLVE_VERBOSE_FAILURE = false; public static boolean ZIP_ACCESS_VERBOSE = false; + // temporary debug flag to track failures of bug 302850 + public static boolean DEBUG_302850 = false; /** * A cache of opened zip files per thread. @@ -2078,6 +2081,16 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis // backward compatibility addDeprecatedOptions(options); + try { + final IEclipsePreferences eclipsePreferences = this.preferencesLookup[PREF_INSTANCE]; + String[] instanceKeys = eclipsePreferences.keys(); + for (int i=0, length=instanceKeys.length; i<length; i++) { + String optionName = instanceKeys[i]; + migrateObsoleteOption(options, optionName, eclipsePreferences.get(optionName, null)); + } + } catch (BackingStoreException e) { + // skip + } Util.fixTaskTags(options); // store built map in cache @@ -2087,6 +2100,63 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis return options; } + /** + * Migrates an old option value to its new corresponding option name(s) + * when necessary. + * <p> + * Nothing is done if the given option is not obsolete or if no migration has been + * specified for it. + * </p><p> + * Currently, migration is only done for formatter options. + * </p> + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=308000" + * + * @param options The options map to update + * @param optionName The old option name to update + * @param optionValue The value of the old option name + */ + public void migrateObsoleteOption(Map options, String optionName, String optionValue) { + + // Migrate formatter options + String[] compatibleConstants = getFormatterCompatibleConstants(optionName); + if (compatibleConstants != null) { + for (int i=0, length=compatibleConstants.length; i < length; i++) { + options.put(compatibleConstants[i], optionValue); + } + return; + } + } + + /** + * Return an array of compatible constants for an obsolete constant. + * + * @param name The name of the obsolete constant + * @return The list as a non-empty array of the compatible constants or + * <code>null</code> if the constant is <b>not</b> obsolete. + * @deprecated As using deprecated formatter constants + */ + private static String[] getFormatterCompatibleConstants(String name) { + if (DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_MEMBER.equals(name)) { + return new String[] { + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE + }; + } + if (DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION.equals(name)) { + return new String[] { + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE, + DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER + }; + } + return null; + } + // Do not modify without modifying getDefaultOptions() private Hashtable getDefaultOptionsNoInitialization() { Map defaultOptionsMap = new CompilerOptions().getMap(); // compiler defaults @@ -3897,6 +3967,7 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis private void saveAccessRules(IAccessRule[] rules) throws IOException { int count = rules == null ? 0 : rules.length; + saveInt(count); for (int i = 0; i < count; ++i) saveAccessRule((ClasspathAccessRule) rules[i]); @@ -4633,14 +4704,27 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis } public void setOptions(Hashtable newOptions) { + + if (DEBUG_302850) { + System.out.println("Entering in JavaModelManager.setOptions():"); //$NON-NLS-1$ + System.out.println(new CompilerOptions(newOptions).toString()); + System.out.println(" - Call stack:"); //$NON-NLS-1$ + StackTraceElement[] elements = new Exception().getStackTrace(); + for (int i=0,n=elements.length; i<n; i++) { + System.out.println(" + "+elements[i]); //$NON-NLS-1$ + } + } - try { Hashtable cachedValue = newOptions == null ? null : new Hashtable(newOptions); IEclipsePreferences defaultPreferences = getDefaultPreferences(); IEclipsePreferences instancePreferences = getInstancePreferences(); if (newOptions == null){ - instancePreferences.clear(); + try { + instancePreferences.clear(); + } catch(BackingStoreException e) { + // ignore + } } else { Enumeration keys = newOptions.keys(); while (keys.hasMoreElements()){ @@ -4660,26 +4744,25 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis instancePreferences.put(key, value); } } + try { + // persist options + instancePreferences.flush(); + } catch(BackingStoreException e) { + // ignore +//{ObjectTeams: harness for Bug 302850 - 13 failures in JavaModel tests for the N20100214-2000 Mac OS X - Cocoa test machine + e.printStackTrace(); + } catch (RuntimeException e) { + e.printStackTrace(); + throw e; + } catch (Error e) { + e.printStackTrace(); + throw e; +// SH} + } } - - // persist options - instancePreferences.flush(); - // update cache Util.fixTaskTags(cachedValue); this.optionsCache = cachedValue; - } catch (BackingStoreException e) { - // ignore -//{ObjectTeams: harness for Bug 302850 - 13 failures in JavaModel tests for the N20100214-2000 Mac OS X - Cocoa test machine - e.printStackTrace(); - } catch (RuntimeException e) { - e.printStackTrace(); - throw e; - } catch (Error e) { - e.printStackTrace(); - throw e; -// SH} - } } public void startup() throws CoreException { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java index 614739c00..dc0f45082 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Stephan Herrmann <stephan@cs.tu-berlin.de> - inconsistent initialization of classpath container backed by external class folder, see https://bugs.eclipse.org/320618 * Technical University Berlin - extended API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.core; @@ -1650,7 +1651,8 @@ public class JavaProject // Get project specific options JavaModelManager.PerProjectInfo perProjectInfo = null; Hashtable projectOptions = null; - HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames; + JavaModelManager javaModelManager = JavaModelManager.getJavaModelManager(); + HashSet optionNames = javaModelManager.optionNames; try { perProjectInfo = getPerProjectInfo(); projectOptions = perProjectInfo.options; @@ -1664,8 +1666,13 @@ public class JavaProject for (int i = 0; i < propertyNames.length; i++){ String propertyName = propertyNames[i]; String value = projectPreferences.get(propertyName, null); - if (value != null && optionNames.contains(propertyName)){ - projectOptions.put(propertyName, value.trim()); + if (value != null) { + if (optionNames.contains(propertyName)){ + projectOptions.put(propertyName, value.trim()); + } else { + // Maybe an obsolete preference, try to migrate it... + javaModelManager.migrateObsoleteOption(projectOptions, propertyName, value.trim()); + } } } // cache project options diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocContents.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocContents.java index dcd779483..284b0329d 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocContents.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocContents.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2010 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 @@ -208,7 +208,8 @@ public class JavadocContents { private void computeChildrenSections() { // try to find the next separator part int lastIndex = CharOperation.indexOf(JavadocConstants.SEPARATOR_START, this.content, false, this.childrenStart); - + lastIndex = lastIndex == -1 ? this.childrenStart : lastIndex; + // try to find field detail start this.indexOfFieldDetails = CharOperation.indexOf(JavadocConstants.FIELD_DETAIL, this.content, false, lastIndex); lastIndex = this.indexOfFieldDetails == -1 ? lastIndex : this.indexOfFieldDetails; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LocalVariable.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LocalVariable.java index a0627a2b6..06a24ebbe 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LocalVariable.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LocalVariable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -39,6 +39,8 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { public int nameStart, nameEnd; String typeSignature; public IAnnotation[] annotations; + private int flags; + private boolean isParameter; public LocalVariable( JavaElement parent, @@ -48,7 +50,9 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { int nameStart, int nameEnd, String typeSignature, - org.eclipse.jdt.internal.compiler.ast.Annotation[] astAnnotations) { + org.eclipse.jdt.internal.compiler.ast.Annotation[] astAnnotations, + int flags, + boolean isParameter) { super(parent); this.name = name; @@ -58,6 +62,8 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { this.nameEnd = nameEnd; this.typeSignature = typeSignature; this.annotations = getAnnotations(astAnnotations); + this.flags = flags; + this.isParameter = isParameter; } protected void closing(Object info) { @@ -243,6 +249,10 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { buff.append(this.nameEnd); buff.append(JEM_COUNT); escapeMementoName(buff, this.typeSignature); + buff.append(JEM_COUNT); + buff.append(this.flags); + buff.append(JEM_COUNT); + buff.append(this.isParameter); if (this.occurrenceCount > 1) { buff.append(JEM_COUNT); buff.append(this.occurrenceCount); @@ -256,6 +266,14 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { public IResource getCorrespondingResource() { return null; } + + /** + * {@inheritDoc} + * @since 3.7 + */ + public IMember getDeclaringMember() { + return (IMember) this.parent; + } public String getElementName() { return this.name; @@ -265,6 +283,14 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { return LOCAL_VARIABLE; } + /** + * {@inheritDoc} + * @since 3.7 + */ + public int getFlags() { + return this.flags; + } + public ISourceRange getNameRange() { return new SourceRange(this.nameStart, this.nameEnd-this.nameStart+1); } @@ -306,6 +332,14 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { return new SourceRange(this.declarationSourceStart, this.declarationSourceEnd-this.declarationSourceStart+1); } + /** + * {@inheritDoc} + * @since 3.7 + */ + public ITypeRoot getTypeRoot() { + return this.getDeclaringMember().getTypeRoot(); + } + public String getTypeSignature() { return this.typeSignature; } @@ -317,10 +351,18 @@ public class LocalVariable extends SourceRefElement implements ILocalVariable { public int hashCode() { return Util.combineHashCodes(this.parent.hashCode(), this.nameStart); } + + /** + * {@inheritDoc} + * @since 3.7 + */ + public boolean isParameter() { + return this.isParameter; + } public boolean isStructureKnown() throws JavaModelException { - return true; - } + return true; + } protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) { buffer.append(tabString(tab)); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java index b4dd2facf..0cb7981cc 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java @@ -215,7 +215,13 @@ public IJavaElement getHandleFromMemento(String token, MementoTokenizer memento, memento.nextToken(); // JEM_COUNT if (!memento.hasMoreTokens()) return this; String typeSignature = memento.nextToken(); - return new LocalVariable(this, varName, declarationStart, declarationEnd, nameStart, nameEnd, typeSignature, null); + memento.nextToken(); // JEM_COUNT + if (!memento.hasMoreTokens()) return this; + int flags = Integer.parseInt(memento.nextToken()); + memento.nextToken(); // JEM_COUNT + if (!memento.hasMoreTokens()) return this; + boolean isParameter = Boolean.getBoolean(memento.nextToken()); + return new LocalVariable(this, varName, declarationStart, declarationEnd, nameStart, nameEnd, typeSignature, null, flags, isParameter); case JEM_TYPE_PARAMETER: if (!memento.hasMoreTokens()) return this; String typeParameterName = memento.nextToken(); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageDeclaration.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageDeclaration.java index bc8708fbc..df8a7528a 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageDeclaration.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageDeclaration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -11,7 +11,6 @@ package org.eclipse.jdt.internal.core; import org.eclipse.jdt.core.*; -import org.eclipse.jdt.core.IPackageDeclaration; /** * @see IPackageDeclaration @@ -44,6 +43,13 @@ public int getElementType() { protected char getHandleMementoDelimiter() { return JavaElement.JEM_PACKAGEDECLARATION; } +/** + * @see IPackageDeclaration#getNameRange() + */ +public ISourceRange getNameRange() throws JavaModelException { + AnnotatableInfo info = (AnnotatableInfo) getElementInfo(); + return info.getNameRange(); +} /* * @see JavaElement#getPrimaryElement(boolean) */ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java index 8977c6adc..ada144c58 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -29,6 +29,7 @@ import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.core.compiler.*; import org.eclipse.jdt.internal.codeassist.ISelectionRequestor; import org.eclipse.jdt.internal.codeassist.SelectionEngine; +import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; @@ -464,7 +465,9 @@ public void acceptLocalVariable(LocalVariableBinding binding) { local.sourceStart, local.sourceEnd, Util.typeSignature(local.type), - binding.declaration.annotations); + local.annotations, + local.modifiers, + local.getKind() == AbstractVariableDeclaration.PARAMETER); } if (localVar != null) { addElement(localVar); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java index 993878f89..23332ef3b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -223,6 +223,8 @@ public class SourceMapper public void acceptImport( int declarationStart, int declarationEnd, + int nameStart, + int nameEnd, char[][] tokens, boolean onDemand, int modifiers) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameter.java index dceffb8d4..1987e4fb5 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameter.java @@ -69,7 +69,7 @@ public class TypeParameter extends SourceRefElement implements ITypeParameter { } public IMember getDeclaringMember() { - return (IMember) getParent(); + return (IMember) getParent(); } public String getElementName() { @@ -117,6 +117,14 @@ public class TypeParameter extends SourceRefElement implements ITypeParameter { public IClassFile getClassFile() { return ((JavaElement)getParent()).getClassFile(); } + + /** + * {@inheritDoc} + * @since 3.7 + */ + public ITypeRoot getTypeRoot() { + return this.getDeclaringMember().getTypeRoot(); + } protected void toStringName(StringBuffer buffer) { buffer.append('<'); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java index a045192e2..85a4c7ff8 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -243,8 +243,16 @@ protected void addDependentsOf(IPath path, boolean isStructuralChange, StringSet if (isStructuralChange) { String last = path.lastSegment(); if (last.length() == TypeConstants.PACKAGE_INFO_NAME.length) - if (CharOperation.equals(last.toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) + if (CharOperation.equals(last.toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) { path = path.removeLastSegments(1); // the package-info file has changed so blame the package itself + /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785, in the case of default package, + there is no need to blame the package itself as there can be no annotations or documentation + comment tags in the package-info file that can influence the rest of the package. Just bail out + so we don't touch null objects below. + */ + if (path.isEmpty()) + return; + } } if (isStructuralChange && !this.hasStructuralChanges) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ReferenceCollection.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ReferenceCollection.java index ed4b725ee..6d8410b4a 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ReferenceCollection.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ReferenceCollection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -21,7 +21,7 @@ char[][] simpleNameReferences; char[][] rootReferences; protected ReferenceCollection(char[][][] qualifiedNameReferences, char[][] simpleNameReferences, char[][] rootReferences) { - this.qualifiedNameReferences = internQualifiedNames(qualifiedNameReferences); + this.qualifiedNameReferences = internQualifiedNames(qualifiedNameReferences, false); this.simpleNameReferences = internSimpleNames(simpleNameReferences, true); this.rootReferences = internSimpleNames(rootReferences, false); } @@ -33,7 +33,7 @@ public void addDependencies(String[] typeNameDependencies) { char[][][] qNames = new char[typeNameDependencies.length][][]; for (int i = typeNameDependencies.length; --i >= 0;) qNames[i] = CharOperation.splitOn('.', typeNameDependencies[i].toCharArray()); - qNames = internQualifiedNames(qNames); + qNames = internQualifiedNames(qNames, false); next : for (int i = qNames.length; --i >= 0;) { char[][] qualifiedTypeName = qNames[i]; @@ -53,7 +53,7 @@ public void addDependencies(String[] typeNameDependencies) { this.qualifiedNameReferences[length] = qualifiedTypeName; qualifiedTypeName = CharOperation.subarray(qualifiedTypeName, 0, qualifiedTypeName.length - 1); - char[][][] temp = internQualifiedNames(new char[][][] {qualifiedTypeName}); + char[][][] temp = internQualifiedNames(new char[][][] {qualifiedTypeName}, false); if (temp == EmptyQualifiedNames) continue next; // qualifiedTypeName is a well known name qualifiedTypeName = temp[0]; @@ -206,10 +206,14 @@ public static char[][][] internQualifiedNames(StringSet qualifiedStrings) { for (int i = 0, l = strings.length; i < l; i++) if (strings[i] != null) result[--length] = CharOperation.splitOn('/', strings[i].toCharArray()); - return internQualifiedNames(result); + return internQualifiedNames(result, false); } public static char[][][] internQualifiedNames(char[][][] qualifiedNames) { + return internQualifiedNames(qualifiedNames, false); +} + +public static char[][][] internQualifiedNames(char[][][] qualifiedNames, boolean keepWellKnown) { if (qualifiedNames == null) return EmptyQualifiedNames; int length = qualifiedNames.length; if (length == 0) return EmptyQualifiedNames; @@ -223,8 +227,12 @@ public static char[][][] internQualifiedNames(char[][][] qualifiedNames) { char[][] wellKnownName = WellKnownQualifiedNames[j]; if (qLength > wellKnownName.length) break; // all remaining well known names are shorter - if (CharOperation.equals(qualifiedName, wellKnownName)) + if (CharOperation.equals(qualifiedName, wellKnownName)) { + if (keepWellKnown) { + keepers[index++] = wellKnownName; + } continue next; + } } // InternedQualifiedNames[0] is for the rest (> 7 & 1) diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/State.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/State.java index 950968783..3b170b51b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/State.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/State.java @@ -46,7 +46,7 @@ private long previousStructuralBuildTime; private StringSet structurallyChangedTypes; public static int MaxStructurallyChangedTypes = 100; // keep track of ? structurally changed types, otherwise consider all to be changed -public static final byte VERSION = 0x0018; // fix for 291472 +public static final byte VERSION = 0x0019; // fix for 325755 static final byte SOURCE_FOLDER = 1; static final byte BINARY_FOLDER = 2; @@ -299,7 +299,7 @@ static State read(IProject project, DataInputStream in) throws IOException { qName[j] = internedSimpleNames[in.readInt()]; internedQualifiedNames[i] = qName; } - internedQualifiedNames = ReferenceCollection.internQualifiedNames(internedQualifiedNames); + internedQualifiedNames = ReferenceCollection.internQualifiedNames(internedQualifiedNames, false); newState.references = new SimpleLookupTable(length = in.readInt()); for (int i = 0; i < length; i++) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java index 340ddaeda..59ad02d14 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -327,7 +327,7 @@ public boolean contains(IType type) { return false; } /** - * Determines if the change effects this hierarchy, and fires + * Determines if the change affects this hierarchy, and fires * change notification if required. */ public void elementChanged(ElementChangedEvent event) { @@ -842,7 +842,7 @@ public synchronized boolean isAffected(IJavaElementDelta delta, int eventType) { /** * Returns true if any of the children of a project, package * fragment root, or package fragment have changed in a way that - * effects this type hierarchy. + * affects this type hierarchy. * @param eventType TODO */ private boolean isAffectedByChildren(IJavaElementDelta delta, int eventType) { @@ -974,11 +974,11 @@ private boolean isAffectedByPackageFragmentRoot(IJavaElementDelta delta, IJavaEl } } } - if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) > 0 || (flags & IJavaElementDelta.F_CONTENT) > 0) { + if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) > 0 || (flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) > 0) { // 1. removed from classpath - if it contains packages we are interested in // the the type hierarchy has changed // 2. content of a jar changed - if it contains packages we are interested in - // the the type hierarchy has changed + // then the type hierarchy has changed IJavaElement[] pkgs = this.packageRegion.getElements(); for (int i = 0; i < pkgs.length; i++) { if (pkgs[i].getParent().equals(element)) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java index 865e74f9e..6744e128b 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -42,7 +42,7 @@ public void acceptProblem(CategorizedProblem problem) { // nothing to do } -public void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers) { +public void acceptImport(int declarationStart, int declarationEnd, int nameStart, int nameEnd, char[][] tokens, boolean onDemand, int modifiers) { int[] sourceRange = {declarationStart, declarationEnd}; String importName = new String(CharOperation.concatWith(tokens, '.')); /** name is set to contain the '*' */ diff --git a/org.eclipse.jdt.core/notes/API_changes.html b/org.eclipse.jdt.core/notes/API_changes.html index 93f1dbec9..0ae31a560 100644 --- a/org.eclipse.jdt.core/notes/API_changes.html +++ b/org.eclipse.jdt.core/notes/API_changes.html @@ -232,7 +232,7 @@ void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor moni * * It is possible that the contents of the original resource have changed * since this working copy was created, in which case there is an update conflict. - * The value of the force parameter effects the resolution of + * The value of the force parameter affects the resolution of * such a conflict: * - true - in this case the contents of this working copy are applied to * the underlying resource even though this working copy was created diff --git a/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html b/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html index 676a991c9..cc985a509 100644 --- a/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html +++ b/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html @@ -721,7 +721,7 @@ public static void addPreProcessingResourceChangedListener(IResourceChangeListen /** * Removes the given pre-processing resource changed listener. * - * Has no affect if an identical listener is not registered. + * Has no effect if an identical listener is not registered. * * @param listener the listener * @since 3.0 @@ -4006,7 +4006,7 @@ void becomeWorkingCopy(IProblemRequestor problemRequestor, IProgressMonitor moni * * It is possible that the contents of the original resource have changed * since this working copy was created, in which case there is an update conflict. - * The value of the force parameter effects the resolution of + * The value of the force parameter affects the resolution of * such a conflict: * - true - in this case the contents of this working copy are applied to * the underlying resource even though this working copy was created diff --git a/org.eclipse.jdt.core/notes/R36_buildnotes_jdt-core.html b/org.eclipse.jdt.core/notes/R36_buildnotes_jdt-core.html new file mode 100644 index 000000000..bfa4eff2d --- /dev/null +++ b/org.eclipse.jdt.core/notes/R36_buildnotes_jdt-core.html @@ -0,0 +1,2283 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> + <meta name="Author" content="IBM"> + <title>JDT/Core Release Notes 3.6</title> + <link rel="stylesheet" href="jdt_core_style.css" charset="iso-8859-1" type="text/css"> +</head> +<body text="#000000" bgcolor="#FFFFFF"> +<table border=0 cellspacing=5 cellpadding=2 width="100%" > + <tr> + <td align="left" width="72%" class="title1"> + <font size="+3"><b>jdt core - build notes 3.6 stream</b></font> + </td> + </tr> + <tr><td align="left" width="72%" class="title2"><font size="-2">Java development tools core</font></td></tr> + <tr><td> </td></tr> + <tr> + <td class="title3"> + <font size="-1"> + Here are the build notes for the Eclipse JDT/Core plug-in project + <a href="http://www.eclipse.org/jdt/core/index.php"><b>org.eclipse.jdt.core</b></a>, + describing <a href="https://bugs.eclipse.org/bugs" target=new>bug</a> resolution and substantial changes in the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core"><b>HEAD</b></a> branch. + For more information on 3.6 planning, please refer to <a href="http://www.eclipse.org/jdt/core/r3.6/index.php#release-plan">JDT/Core release plan</a>, + the next <a href="http://www.eclipse.org/jdt/core/r3.6/index.php#milestone-plan">milestone plan</a>, + the overall <a href="http://www.eclipse.org/eclipse/development/eclipse_project_plan_3_6.html">official plan</a>, + or the <a href="http://www.eclipse.org/eclipse/platform-releng/buildSchedule.html">build schedule</a>. + This present document covers all changes since Release 3.5 (also see a summary of <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/API_changes.html">API changes</a>). + <br>Maintenance of previous releases of JDT/Core is performed in parallel branches: + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R3_5_maintenance">R3.5.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R3_4_maintenance">R3.4.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R3_3_maintenance">R3.3.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R3_2_maintenance">R3.2.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R3_1_maintenance">R3.1.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R3_0_maintenance">R3.0.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R2_1_maintenance">R2.1.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R2_0_1">R2.0.x</a>, + <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=ECLIPSE_1_0">R1.0.x</a>. + </font> + </td> + </tr> +</table> +<a name="v_A58"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6 - June 3, 2010 - 3.6.0 +<br>Project org.eclipse.jdt.core v_A58 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A58">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=315568">315568</a> +improve Javadoc of SearchPattern#createPattern(String, int, int, int) + +<a name="v_A57"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC4 - June 3, 2010 - 3.6.0 RC4 +<br>Project org.eclipse.jdt.core v_A57 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A57">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>Use default disabling/enabling tags in the samples of the Javadoc comments +of the formatter constants <code>FORMATTER_DISABLING_TAG</code> and +<code>FORMATTER_ENABLING_TAG</code>.</li> +<li>Fixed minor javadoc issues of <code>createStrictHierarchyScope()</code>.</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=314709">314709</a> +Clarify -encoding <encoding name> in jdt_api_compile.htm + +<a name="v_A56"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC3 - May 27, 2010 - 3.6.0 RC3 +<br>Project org.eclipse.jdt.core v_A56 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A56">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313890">313890</a> +Migration guide to 3.6 for containers with MANIFEST-referred entries +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313965">313965</a> +Breaking change in classpath container API + +<a name="v_A55"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC3 - May 25, 2010 +<br>Project org.eclipse.jdt.core v_A55 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A55">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313706">313706</a> +Replace ie. with i.e. in jdt.core documentation + +<a name="v_A54"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC2 - May 20, 2010 - 3.6.0 RC2 +<br>Project org.eclipse.jdt.core v_A54 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A54">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li> +Added a new preference to force the formatter to try to keep nested expressions on one line. +<p> +This new preference is controlled with the option:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_WRAP_OUTER_EXPRESSIONS_WHEN_NESTED</code> +<pre> +/** + * FORMATTER / Option to wrap outer expressions in nested expressions + * - option id: "org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" + * - possible values: { TRUE, FALSE } + * - default: TRUE + * + * This option changes the formatter behavior when nested method calls are encountered. + * Since 3.6, the formatter tries to wrap outermost method calls first to have a better output. + * For example, let's say we are using the Eclipse built-in profile with a max line width=40+space for tab policy. + * Then consider the following snippet: + * + * public class X01 { + * void test() { + * foo(bar(1, 2, 3, 4), bar(5, 6, 7, 8)); + * } + * } + * + * With this new strategy, the formatter will wrap the line earlier, between the arguments of the message call + * for this example, and then it will allow to keep each nested call on a single line. + * Hence, the output will be: + * + * public class X01 { + * void test() { + * foo(bar(1, 2, 3, 4), + * bar(5, 6, 7, 8)); + * } + * } + * + * Important notes: + * 1. This new behavior is automatically activated (i.e. the default value for this preference is {@link #TRUE}). + * If the backward compatibility regarding previous versions' formatter behavior (i.e. before 3.6 version) is necessary, + * then the preference needs to be set to {@link #FALSE} to retrieve the previous formatter behavior. + * 2. The new strategy currently only applies to nested method calls, but might be extended to other nested expressions in future versions + * + * @see #TRUE + * @see #FALSE + * @since 3.6 + */ +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313524">313524</a> for more details. +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313524">313524</a> +[formatter] Add preference for improved lines wrapping in nested method calls +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=313109">313109</a> +@SuppressWarnings on multiple locals is marked unnecessary if any local is never used + +<a name="v_A53"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC1 - May 12, 2010 - 3.6.0 RC1 +<br>Project org.eclipse.jdt.core v_A53 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A53">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=312326">312326</a> +IllegalArgumentException using open type dialog +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310159">310159</a> +Hang in JavaModel.getExternalTarget(JavaModel.java:333) + +<a name="v_A52"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC1 - May 11, 2010 +<br>Project org.eclipse.jdt.core v_A52 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A52">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=157847">157847</a> +NPE in WildcardBinding.computeUniqueKey during code assist +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311849">311849</a> +[quick fix] @SuppressWarnings does not work as expected inside a for loop + +<a name="v_A51"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC1 - May 8, 2010 +<br>Project org.eclipse.jdt.core v_A51 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A51">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306170">306170</a> +[perfs] Regression for FullSourceWorkspaceTypeHierarchyTests#testPerfAllTypes() +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298844">298844</a> +[formatter] New lines in empty method body wrong behavior +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311864">311864</a> +[formatter] NPE with empty {@code } + +<a name="v_A50"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC1 - May 6, 2010 +<br>Project org.eclipse.jdt.core v_A50 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A50">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li> +Added a new preference to switch on/off the usage of the disabling/enabling tags of the formatter. +<p> +This new preference is controlled with the option:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS</code> +<pre> +/** + * FORMATTER / Option to use the disabling and enabling tags defined respectively by the {@link #FORMATTER_DISABLING_TAG} and the {@link #FORMATTER_ENABLING_TAG} options. + * - option id: "org.eclipse.jdt.core.formatter.use_on_off_tags" + * - possible values: TRUE / FALSE + * - default: FALSE + * + * @since 3.6 + */ +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582">311582</a> for more details. +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311617">311617</a> +[formatter] provide default tags to enable/disable formatter +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582">311582</a> +[formatter] Master switch to enable/disable on/off tags +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307040">307040</a> +Search Job with HierarchyScope on Object does not cancel +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302295">302295</a> +After associating source folder with rt.jar project refresh takes exceedingly long time. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311048">311048</a> +AbortCompilation propagated from CompilationUnitProblemFinder.process() + +<a name="v_A49"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6RC1 - May 4, 2010 +<br>Project org.eclipse.jdt.core v_A49 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A49">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310811">310811</a> +[perfs] Big regression on FullSourceWorkspaceFormatterTests#testFormatDefaultBigFile() + +<a name="v_A48"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - April 25, 2010 - 3.6.0 M7 +<br>Project org.eclipse.jdt.core v_A48 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A48">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310330">310330</a> +Add multiple encoding support for the batch compiler + +<a name="v_A47"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - April 25, 2010 +<br>Project org.eclipse.jdt.core v_A47 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A47">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309835">309835</a> +[formatter] adds blank lines on each run +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310213">310213</a> +AIOOBE in IndexSelector.initializeIndexLocations() +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309966">309966</a> +IType#getKey() does not work for unresolved local ITypes + +<a name="v_A46"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - April 23, 2010 +<br>Project org.eclipse.jdt.core v_A46 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A46">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=59891">59891</a> +[formatter] improve lines wrapping in nested method calls +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306172">306172</a> +[perfs] Invalid test duration for FullSourceWorkspaceTypeHierarchyTests#testPerSuperTypes() +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267091">267091</a> +[content assist] After 'implements' interface members are not proposed +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261534">261534</a> +content assist after instanceof should also work after && +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308980">308980</a> +[content assist]An initializer inside a non-array field declaration confuses content assist +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=310002">310002</a> +ToolFactory.createScanner(..) should use workspace compliance +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291528">291528</a> +Synchronize project warning/error settings to build.properties +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309787">309787</a> +Extension point "org.eclipse.jdt.core.codeFormatter" is ignored +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=244820">244820</a> +Content assist after 'instanceof' should also work in assignment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309706">309706</a> +[formatter] doesn't work when code has three semicolons side by side + +<a name="v_A45"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - April 20, 2010 +<br>Project org.eclipse.jdt.core v_A45 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A45">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305037">305037</a> +missing story for attributes of referenced JARs in classpath containers +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305116">305116</a> +[index] Improve performance of indexes results tables +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236306">236306</a> +[content assist] for method invocation in variable initializer should not guess variable +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302865">302865</a> +Issue with "import" a class and "import static" a method with the same name +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=309022">309022</a> +[ImportRewrite] Add Import wrongly removes import for nested type + +<a name="v_A44"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - April 13, 2010 +<br>Project org.eclipse.jdt.core v_A44 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A44">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308754">308754</a> +CompilationUnit.rewrite messes up .class-literal in annotation instead of changing class to interface +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306519">306519</a> +JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject) should allow null project +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308428">308428</a> +Possible problem to get corrections with surrogate characters +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307295">307295</a> +Task tags and task priorities +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308476">308476</a> +Test ClasspathTests#testBug308150 fails on all platforms +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305043">305043</a> +Internal error during classpath init +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307486">307486</a> +DBCS3.6: Fail to propose Ext-B labels with content assist in Java Editor +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308256">308256</a> +DiagnosticListener always supplies Diagnostic.getSource()==null +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308356">308356</a> +codeSelect(..) doesn't work for local variable with surrogate in name +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308245">308245</a> +Valid code fails to compile in 3.6 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307885">307885</a> +Error message for instanceof <parameterized type> wrong arguments +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=249704">249704</a> +[code assist] autocomplete with anonymous classes does stop working +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=308150">308150</a> +JAR with invalid Class-Path entry in MANIFEST.MF crashes the project + +<a name="v_A43"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - April 6, 2010 +<br>Project org.eclipse.jdt.core v_A43 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A43">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306223">306223</a> +[search] Searching for annotation references report all type references +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292087">292087</a> +anonymous class in array member initializer confuses content assist +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=307337">307337</a> +[content assist] Default constructor should not be proposed for anonymous types +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306568">306568</a> +[ImportRewrite] Add Import does not work for nested type when package is on-demand imported + +<a name="v_A42"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - March 30, 2010 +<br>Project org.eclipse.jdt.core v_A42 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A42">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=202634">202634</a> +[codeassist] missing super proposal in specific source +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304394">304394</a> +IJavaElement#getAttachedJavadoc(IProgressMonitor) should support referenced entries +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305122">305122</a> +FUP of 302949 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306917">306917</a> +Exception occurred during compilation unit conversion: +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306196">306196</a> +[search] NPE while searching for annotation references in rt.jar of JRE 6.0 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288658">288658</a> +[compiler][1.5] Annotations visibility issues + +<a name="v_A41"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - March 23, 2010 +<br>Project org.eclipse.jdt.core v_A41 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A41">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305518">305518</a> +[formatter] Line inside <pre> tag is wrongly indented by one space when starting just after the star +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295825">295825</a> +[formatter] Commentaries are running away after formatting are used +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306477">306477</a> +Indexer(?) fails to recognise enum as a type +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305830">305830</a> +[formatter] block comment should not be formatted when a non-nls tag is on the same line +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300031">300031</a> +The deprecation warning for a type should not include the package name +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306078">306078</a> +Navigate to Inaccessible Field +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=209479">209479</a> +infinite loop in BindingKey when signatures are invalid +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293558">293558</a> +[quick assist] "Invert if statement" fails when comment follows +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=182459">182459</a> +[compiler] Inconsistent error range for unresolved field +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=192233">192233</a> +[AST] CompilationUnit.rewrite() removes whitespace between return type and method name +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=306073">306073</a> +ASTRewrite Javadoc wrongly talks about getTargetSourceRangeComputer +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305001">305001</a> +Exception occurred in listener of Java element change notification +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305590">305590</a> +Redundant null check false-positive +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305755">305755</a> +Remove deprecated API that has been added for 3.6 + +<a name="v_A40"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M7 - March 16, 2010 +<br>Project org.eclipse.jdt.core v_A40 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A40">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305371">305371</a> +[formatter] Unexpected indentation of line comment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=305281">305281</a> +[formatter] Turning off formatting changes comment's formatting + +<a name="v_A39"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M6 - March 9, 2010 - 3.6.0 M6 +<br>Project org.eclipse.jdt.core v_A39 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A39">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289057">289057</a> +Java Content Assist taking too long +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303830">303830</a> +"X cannot be resolved or is not a field" erroneously reported +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235658">235658</a> +Valid identifier unrecognized. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304841">304841</a> +[search] NPE in IndexSelector.initializeIndexLocations +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295866">295866</a> +FormalParameter in JDT DOM/AST documentation +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304817">304817</a> +Review documentation of ASTParser class + +<a name="v_A38"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M6 - March 5, 2010 +<br>Project org.eclipse.jdt.core v_A38 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A38">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li> +Added two new preferences to allow to disable the formatter in a section of the code. +These two preference define respectively the tag which disables the formatting +and the tag which re-enable it. +<p> +These new preferences are controlled with the options:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG</code> +<code>DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG</code> +<pre> +/** + * FORMATTER / Option to define the tag to put in a comment to disable the formatting. + * See the {@link #FORMATTER_ENABLING_TAG} option to re-enable it. + * - option id: "org.eclipse.jdt.core.formatter.disabling_tag" + * - possible values: String, with constraints mentioned below + * - default: "" + * + * Note that: + * + * 1. The tag name will be trimmed. Hence if it does contain white spaces + * at the beginning or at the end, they will not be taken into account while + * searching for the tag in the comments + * 2. If a tag is starting with a letter or digit, then it cannot be leaded by + * another letter or digit to be recognized + * (<b><i>"ToDisableFormatter"</i></b> will not be recognized as a disabling tag + * <b><i>"DisableFormatter"</i></b>, but <b><i>"Re:DisableFormatter"</i></b> + * will be detected for either tag <b><i>"DisableFormatter"</i></b> or + * <b><i>":DisableFormatter"</i></b>). + * Respectively, a tag ending with a letter or digit cannot be followed by a letter + * or digit to be recognized (<b><i>"DisableFormatter1"</i></b> will not be + * recognized as a disabling tag <b><i>"DisableFormatter"</i></b>, but + * <b><i>"DisableFormatter:1"</i></b> will be detected either for tag + * <b><i>"DisableFormatter"</i></b> or <b><i>"DisableFormatter:"</i></b>) + * 3. As soon as the formatter encounters the defined disabling tag, it stops to + * format the code from the beginning of the comment including this tag. If it + * was already disabled, the tag has no special effect. + * For example, the second defined enabling tag "<b>disable-formatter</b>" + * in the following snippet is not necessary as the formatter was already disabled + * since the first one: + * class X { + * // disable-formatter + * void foo1() {} + * // disable-formatter + * void foo2() {} + * void bar1() {} + * void bar2() {} + * } + * + * 4. If no enabling tag is found by the formatter after the disabling tag, then + * the end of the snippet won't be formatted. + * For example, when a disabling tag is put at the beginning of the code, then + * the entire content of a compilation unit is not formatted: + * // disable-formatter + * class X { + * void foo1() {} + * void foo2() {} + * void bar1() {} + * void bar2() {} + * } + * + * 5. If a mix of disabling and enabling tags is done in the same comment, then + * the formatter will only take into account the last encountered tag in the + * comment. + * For example, in the following snippet, the formatter will be disabled after + * the comment: + * class X { + * /* + * * This is a comment with a mix of disabling and enabling tags: + * * - <b>disable-formatter</b> + * * - <b>enable-formatter</b> + * * - <b>disable-formatter</b> + * * The formatter will stop to format from the beginning of this comment... + * */ + * void foo() {} + * void bar() {} + * } + * + * 6. The tag cannot include newline character (i.e. '\n') but it can have white spaces. + * E.g. "<b>format: off</b>" is a valid disabling tag + * In the future, newlines may be used to support multiple disabling tags. + * + * @since 3.6 + */ + +/** + * FORMATTER / Option to define the tag to put in a comment to re-enable the + * formatting after it has been disabled (see {@link #FORMATTER_DISABLING_TAG}) + * - option id: "org.eclipse.jdt.core.formatter.enabling_tag" + * - possible values: String, with constraints mentioned below + * - default: "" + * + * Note that: + * + * 1. The tag name will be trimmed. Hence if it does contain white spaces + * at the beginning or at the end, they will not be taken into account while + * searching for the tag in the comments + * 2. If a tag is starting with a letter or digit, then it cannot be leaded by + * another letter or digit to be recognized + * (<b>"ReEnableFormatter"</b> will not be recognized as an enabling tag + * <b><i>"EnableFormatter"</i></b>, but <b><i>"Re:EnableFormatter"</i></b> + * will be detected for either tag <b><i>"EnableFormatter"</i></b> or + * <b><i>":EnableFormatter"</i></b>). + * Respectively, a tag ending with a letter or digit cannot be followed by a letter + * or digit to be recognized (<b><i>"EnableFormatter1"</i></b> will not be + * recognized as an enabling tag <b><i>"EnableFormatter"</i></b>, but + * <b><i>"EnableFormatter:1"</i></b> will be detected either for tag + * <b><i>"EnableFormatter"</i></b> or <b><i>"EnableFormatter:"</i></b>) + * 3. As soon as the formatter encounters the defined enabling tag, it re-starts + * to format the code just after the comment including this tag. If it was already + * active, i.e. already re-enabled or never disabled, the tag has no special effect. + * For example, the defined enabling tag "<b>enable-formatter</b>" + * in the following snippet is not necessary as the formatter has never been + * disabled: + * class X { + * void foo1() {} + * void foo2() {} + * // enable-formatter + * void bar1() {} + * void bar2() {} + * } + * + * Or, in the following other snippet, the second enabling tag is not necessary as + * the formatting will have been re-enabled by the first one: + * class X { + * // disable-formatter + * void foo1() {} + * void foo2() {} + * // enable-formatter + * void bar1() {} + * // enable-formatter + * void bar2() {} + * } + * + * 4. If a mix of disabling and enabling tags is done in the same comment, then + * the formatter will only take into account the last encountered tag in the + * comment. + * For example, in the following snippet, the formatter will be re-enabled after + * the comment: + * // disable-formatter + * class X { + * /* + * * This is a comment with a mix of disabling and enabling tags: + * * - <b>enable-formatter</b> + * * - <b>disable-formatter</b> + * * - <b>enable-formatter</b> + * * The formatter will restart to format after this comment... + * */ + * void foo() {} + * void bar() {} + * } + * + * 5. The tag cannot include newline character (i.e. '\n') but it can have white spaces. + * E.g. "<b>format: on</b>" is a valid enabling tag + * In the future, newlines may be used to support multiple enabling tags. + * + * @since 3.6 + */ +</pre> +<p>For example, the following snippet:</p> +<pre> +public class Test { +/* disable-formatter */ +void foo( ) { + // unformatted area +} +/* enable-formatter */ +void bar( ) { + // formatted area +} +} +</pre> +formatted with disabling tags = "disable-formatter" and enabling tags += "enable-formatter" produces the following output: +<pre> +public class Test { + +/* disable-formatter * +void foo( ) { + // unformatted area +} +/* enable-formatter * + void bar() { + // formatted area + } +} +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=27079">27079</a> for more details. +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=129804">129804</a> +[dom] Local variable bindings from ASTParser#createASTs(.., String[], .., ..) have no declaring method +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304705">304705</a> +[formatter] Unexpected indentation of wrapped line comments when 'Never indent line comment on first column' preference is checked +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304656">304656</a> +StringIndexOutOfBoundsException when using JDT dom methods to process sourcefile +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304506">304506</a> +Task descriptions always have a space after the tag +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304081">304081</a> +IJavaProject#isOnClasspath(IJavaElement) returns false for type from referenced JAR +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304122">304122</a> +TypeBindings.getAnnotations() breaks interface +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304416">304416</a> +VerifyError after compiling without preserve all locals +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304529">304529</a> +[formatter] NPE when either the disabling or the enabling tag is not defined +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=27079">27079</a> +Tags for disabling/enabling code formatter (feature) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304316">304316</a> +NPE when javadoc URL is invalid + +<a name="v_A37"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M6 - March 2, 2010 +<br>Project org.eclipse.jdt.core v_A37 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A37">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>Added new configurable option to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551">295551</a>:<br> +<pre> +/** + * Compiler option ID: Further Determining the Effect of @SuppressWarnings if also + * COMPILER_PB_SUPPRESS_WARNINGS is enabled. + * When enabled, the @SuppressWarnings annotation can additionally be used to suppress + * optional compiler diagnostics that have been configured as ERROR. + * When disabled, all @SuppressWarnings annotations only affects warnings. + * + * Option id: "org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors" + * Possible values: { "enabled", "disabled" } + * Default: "disabled" + * + * @since 3.6 + * @category CompilerOptionID + */ +public static final String COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS = PLUGIN_ID + ".compiler.problem.suppressOptionalErrors"; +</pre> +</li> +<li> +Added a new formatter preferences to align method declaration. +<p> +This new preference is controlled with the option:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_METHOD_DECLARATION</code> +<pre> +/** + * FORMATTER / Option for alignment of method declaration + * - option id: "org.eclipse.jdt.core.formatter.alignment_for_method_declaration" + * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call + * - default: createAlignmentValue(false, WRAP_NO_SPLIT, INDENT_DEFAULT) + * + * @see #createAlignmentValue(boolean, int, int) + * @since 3.6 + */ +</pre> +<p>For example, the following snippet:</p> +<pre> +public class Test { +public final synchronized java.lang.String a_method_which_has_a_very_long_name() { +return null; +} +} +</pre> +formatted with this preference activated as 'Wrap only when necessary', will +produce the following output: +<pre> +public class Test { + public final synchronized java.lang.String + a_method_which_has_a_very_long_name() { + return null; + } +} +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284789">284789</a> for more details. +</li> +<li>New API to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=246594">246594</a>. See the bug for details. +<pre> +org.eclipse.jdt.core.ITypeParameter + /** + * Returns the signatures for this type parameter's bounds. The type parameter may have + * been declared as part of a type or a method. The signatures represent only the individual + * bounds and do not include the type variable name or the <code>extends</code> keyword. + * The signatures may be either unresolved (for source types) or resolved (for binary types). + * See {@link Signature} for details. + * + * @return the signatures for the bounds of this formal type parameter + * @throws JavaModelException + * if this element does not exist or if an exception occurs while accessing its corresponding resource. + * @see Signature + * @since 3.6 + */ + String[] getBoundsSignatures() throws JavaModelException; +</pre> +</li> +<li> +Added a new formatter preference to enable or disable the formatting of line +comments that start on the first column.<br> +Note that the indentation of line comments will also be disabled when activating +this option, as otherwise the formatter could not produce stable outputs... +<p> +The default is to format these comments to have a backward compatible behavior. +</p><p> +This new preferences is controlled with the options:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT_STARTING_ON_FIRST_COLUMN</code> +<pre> +/** + * FORMATTER / Option to format line comments that start on the first column + * - option id: "org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" + * - possible values: { TRUE, FALSE } + * - default: TRUE + * + * Note that this option is ignored if either the + * {@link #FORMATTER_COMMENT_FORMAT_LINE_COMMENT} option has been set to + * {@link #FALSE} or the formatter is created with the mode + * {@link ToolFactory#M_FORMAT_NEW}. + * + * @see #TRUE + * @see #FALSE + * @see ToolFactory#createCodeFormatter(Map, int) + * @since 3.6 + */ +</pre> +<p>For example, the following snippet:</p> +<pre> +public class X01 { +// int a = 1; +// int b = 2; +} +</pre> +will be untouched by the formatter if both options are activated. +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=251133">251133</a> for more details. +</li> +<li>New API to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=252431">252431</a>. See the bug for details. +<pre> +org.eclipse.jdt.core.IClasspathEntry + /** + * Returns the classpath entry that is making a reference to this classpath entry. For entry kinds + * {@link #CPE_LIBRARY}, the return value is the entry that is representing the JAR that includes + * <code>this</code> in the MANIFEST.MF file's Class-Path section. For entry kinds other than + * {@link #CPE_LIBRARY}, this returns <code>null</code>. For those entries that are on the raw classpath already, + * this returns <code>null</code>. + * + * It is possible that multiple library entries refer to the same entry + * via the MANIFEST.MF file. In those cases, this method returns the first classpath entry + * that appears in the raw classpath. However, this does not mean that the other referencing + * entries do not relate to their referenced entries. + * See {@link JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject)} for + * more details. + * + * @return the classpath entry that is referencing this entry or <code>null</code> if + * not applicable. + * @since 3.6 + */ + IClasspathEntry getReferencingEntry(); + + +org.eclipse.jdt.core.IJavaProject + /** + * Works similar to {@link #setRawClasspath(IClasspathEntry[], IPath, IProgressMonitor)} and + * additionally allows persisting the given array of referenced entries for this project. + * The referenced entries and their attributes are stored in the .classpath file of this + * project. For details on referenced entries, see + * {@link JavaCore#getReferencedClasspathEntries(IClasspathEntry, IJavaProject)} + * and {@link IClasspathEntry#getReferencingEntry()}. + * + * Since the referenced entries are stored in the .classpath file, clients can store additional + * information that belong to these entries and retrieve them across sessions, though the referenced + * entries themselves may not be present in the raw classpath. By passing a <code>null</code> + * referencedEntries, clients can choose not to modify the already persisted referenced entries, + * which is fully equivalent to {@link #setRawClasspath(IClasspathEntry[], IPath, IProgressMonitor)}. + * If an empty array is passed as referencedEntries, the already persisted referenced entries, + * if any, will be cleared. + * + * If there are duplicates of a referenced entry or if any of the <code>referencedEntries</code> + * is already present in the raw classpath(<code>entries</code>) those referenced entries will + * be excluded and not be persisted. + * + * @param entries a list of classpath entries + * @param referencedEntries the list of referenced classpath entries to be persisted + * @param outputLocation the default output location + * @param monitor the given progress monitor + * @exception JavaModelException if the classpath could not be set. Reasons include: + * This Java element does not exist (ELEMENT_DOES_NOT_EXIST) + * The classpath is being modified during resource change event notification (CORE_EXCEPTION) + * The classpath failed the validation check as defined by {@link JavaConventions#validateClasspath(IJavaProject, IClasspathEntry[], IPath)} + * @see IClasspathEntry + * @see #getReferencedClasspathEntries() + * @since 3.6 + */ + void setRawClasspath(IClasspathEntry[] entries, IClasspathEntry[] referencedEntries, IPath outputLocation, + IProgressMonitor monitor) throws JavaModelException; + + /** + * Returns the list of referenced classpath entries stored in the .classpath file of <code>this</code> + * java project. Clients can store the referenced classpath entries using + * {@link #setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, IProgressMonitor)} + * If the client has not stored any referenced entries for this project, an empty array is returned. + * + * @throws JavaModelException + * @return an array of referenced classpath entries stored for this java project or an empty array if none + * stored earlier. + * @since 3.6 + */ + IClasspathEntry[] getReferencedClasspathEntries() throws JavaModelException; + + +org.eclipse.jdt.core.IPackageFragmentRoot + /** + * Returns the first resolved classpath entry that corresponds to this package fragment root. + * A resolved classpath entry is said to correspond to a root if the path of the resolved + * entry is equal to the root's path. + * + * @return the first resolved classpath entry that corresponds to this package fragment root + * @throws JavaModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource. + * @since 3.6 + */ + IClasspathEntry getResolvedClasspathEntry() throws JavaModelException; + + +org.eclipse.jdt.core.JavaCore + /** + * Returns an array of classpath entries that are referenced directly or indirectly + * by a given classpath entry. For the entry kind {@link IClasspathEntry#CPE_LIBRARY}, + * the method returns the libraries that are included in the Class-Path section of + * the MANIFEST.MF file. If a referenced JAR file has further references to other library + * entries, they are processed recursively and added to the list. For entry kinds other + * than {@link IClasspathEntry#CPE_LIBRARY}, this method returns an empty array. + * + * If a referenced entry has already been stored + * in the given project's .classpath, the stored attributes are populated in the corresponding + * referenced entry. For more details on storing referenced entries see + * see {@link IJavaProject#setRawClasspath(IClasspathEntry[], IClasspathEntry[], IPath, + * IProgressMonitor)}. + * + * @param libraryEntry the library entry whose referenced entries are sought + * @param project project where the persisted referenced entries to be retrieved from + * @return an array of classpath entries that are referenced directly or indirectly by the given entry. + * If not applicable, returns an empty array. + * @since 3.6 + */ + public static IClasspathEntry[] getReferencedClasspathEntries(IClasspathEntry libraryEntry, IJavaProject project); +</pre> +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=252431">252431</a> +New API is needed to better identify referenced jars in the Class-Path: entry +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=251133">251133</a> +[formatter] Automatic formatting single line comments is incoherent among tools +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=248897">248897</a> +[1.5][compiler] Wrong warning 'The local variable 'var' is never read'. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031">304031</a> +Unused @SuppressWarnings(..) not flagged when suppressed problem is set to Error +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295551">295551</a> +Add option to automatically promote all warnings to errors +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303810">303810</a> +Compact boolean fields on FlowContext +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=251227">251227</a> +[compiler] Fup of bug 115814, comparing doubles should not be flagged +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=268798">268798</a> +[1.5][compiler] Eclipse 3.5M5/6 produces new compiler errors with generics +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448">303448</a> +Wrong code generation optimization when assert condition is false +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303776">303776</a> +Member types imports are removed too aggressively +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302949">302949</a> +JavaModelManager hangs accessing the nonChainingJars set +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=246594">246594</a> +[model] API request: ITypeParameter#getBoundsSignatures() or #getSignature() +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=253896">253896</a> +[compiler][null] wrong "Null comparison always yields false" problem for auto-unboxing +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284789">284789</a> +[formatter] Does not line-break method declaration exception with parameters +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303480">303480</a> +[1.5][compiler] CCE: org.eclipse.jdt.internal.compiler.parser.RecoveredBlock cannot be cast to org.eclipse.jdt.internal.compiler.parser.RecoveredType + +<a name="v_A36"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M6 - February 23, 2010 +<br>Project org.eclipse.jdt.core v_A36 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A36">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li> +Added a new formatter preferences to align annotation arguments (i.e. element-value pairs). +<p> +This new preference is controlled with the option:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ANNOTATION</code> +<pre> +/** + * FORMATTER / Option for alignment of arguments in annotation + * - option id: "org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" + * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call + * - default: createAlignmentValue(false, WRAP_NO_SPLIT, INDENT_DEFAULT) + * + * @see #createAlignmentValue(boolean, int, int) + * @since 3.6 + */ +</pre> +<p>For example, the following snippet:</p> +<pre> +@MyAnnot(value1 = "this is an example", value2 = "of an annotation", value3 = "with several arguments", value4 = "which may need to be wrapped") +public class Test { +} +</pre> +formatted with this preference activated, will produce the following output +while using the <code>Eclipse [built-in]</code> profile: +<pre> +@MyAnnot(value1 = "this is an example", value2 = "of an annotation", + value3 = "with several arguments", + value4 = "which may need to be wrapped") +public class Test { +} +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282030">282030</a> for more details. +</li> +<li>In order to get bindings outside the Eclipse environment, the following methods has been added on the ASTParser class. +<br>See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=206391">206391</a> for details.<br> +<pre> +org.eclipse.jdt.core.dom.ASTParser + /** + * Set the environment that can be used when no IJavaProject are available. + * + * The user has to be sure to include all required types on the classpaths for binary types + * or on the sourcepaths for source types to resolve the given source code. + * All classpath and sourcepath entries are absolute paths. + * If sourcepaths contain units using a specific encoding (not the platform encoding), then the + * given encodings must be set. If the given encodings is set, its length must + * match the length of the sourcepaths parameter or an IllegalArgumentException will be thrown. + * If encodings is not null, the given sourcepathEntries must not be null. + * + * @param classpathEntries the given classpath entries to be used to resolve bindings + * @param sourcepathEntries the given sourcepath entries to be used to resolve bindings + * @param encodings the encodings of the corresponding sourcepath entries or null if the platform encoding + * can be used. + * @param includeRunningVMBootclasspath true if the bootclasspath of the running VM must be prepended to the + * given classpath and false if the bootclasspath of the running VM should be ignored. + * @throws IllegalArgumentException if the size of the given encodings is not equals to the size of the given + * sourcepathEntries + * @since 3.6 + */ + public void setEnvironment(String[] classpathEntries, String[] sourcepathEntries, String[] encodings, boolean includeRunningVMBootclasspath); + + /** + * Creates ASTs for a batch of compilation units. When bindings are being resolved, processing a + * batch of compilation units is more efficient because much of the work involved in resolving + * bindings can be shared. + * + * When bindings are being resolved, all compilation units are resolved + * using the same environment, which must be set beforehand with + * {@link #setEnvironment(String[], String[], String[], boolean) setEnvironment}. + * The compilation units are processed one at a time in no specified order. + * For each of the compilation units in turn, + * - {@link ASTParser#createAST(IProgressMonitor) ASTParser.createAST} is called to parse it + * and create a corresponding AST. The calls to {@link ASTParser#createAST(IProgressMonitor) ASTParser.createAST} + * all employ the same settings.</li> + * - {@link FileASTRequestor#acceptAST(String, CompilationUnit) FileASTRequestor.acceptAST} is called passing + * the compilation unit path and the corresponding AST to <code>requestor</code>. The compilation unit path is the same + * path that is passed into the given <code>sourceFilePaths</code> parameter. + * + * Note only ASTs from the given compilation units are reported + * to the requestor. If additional compilation units are required to + * resolve the original ones, the corresponding ASTs are <b>not</b> + * reported to the requestor. + * + * Note also the following parser parameters are used, regardless of what + * may have been specified: + * - The {@linkplain #setKind(int) parser kind} is <code>K_COMPILATION_UNIT</code> + * - The {@linkplain #setSourceRange(int,int) source range} is <code>(0, -1)</code> + * - The {@linkplain #setFocalPosition(int) focal position} is not set + * + * The <code>bindingKeys</code> parameter specifies bindings keys + * ({@link IBinding#getKey()}) that are to be looked up. These keys may + * be for elements either inside or outside the set of compilation + * units being processed. When bindings are being resolved, + * the keys and corresponding bindings (or <code>null</code> if none) are + * passed to {@link FileASTRequestor#acceptBinding(String, IBinding) FileASTRequestor.acceptBinding}. Note that binding keys + * for elements outside the set of compilation units being processed are looked up + * after all {@link FileASTRequestor#acceptAST(String, CompilationUnit) ASTRequestor.acceptAST} + * callbacks have been made. + * Binding keys for elements inside the set of compilation units being processed + * are looked up and reported right after the corresponding + * {@link FileASTRequestor#acceptAST(String, CompilationUnit) FileASTRequestor.acceptAST} callback has been made. + * No {@link FileASTRequestor#acceptBinding(String, IBinding) FileASTRequestor.acceptBinding} callbacks are made unless + * bindings are being resolved. + * + * A successful call to this method returns all settings to their + * default values so the object is ready to be reused. + * + * The given <code>encodings</code> are used to properly parse the given source units. If the platform encoding is sufficient, + * then the given encodings can be set to <code>null</code>. + * + * @param sourceFilePaths the compilation units to create ASTs for + * @param encodings the given encoding for the source units + * @param bindingKeys the binding keys to create bindings for + * @param requestor the AST requestor that collects abstract syntax trees and bindings + * @param monitor the progress monitor used to report progress and request cancellation, + * or <code>null</code> if none + * @exception IllegalStateException if the settings provided + * are insufficient, contradictory, or otherwise unsupported + * @since 3.6 + */ + public void createASTs(String[] sourceFilePaths, String[] encodings, String[] bindingKeys, FileASTRequestor requestor, IProgressMonitor monitor) +</pre> +</li> +<li> +Added two new formatter preferences to condense block and javadoc comments. +<p> +These new preferences are controlled respectively with the options:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES</code><br> +<code>DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES</code> +<pre> +/** + * FORMATTER / Option to control whether block comments will have new lines at boundaries + * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" + * - possible values: { TRUE, FALSE } + * - default: TRUE + * + * @see #TRUE + * @see #FALSE + * @since 3.6 + */ + +/** + * FORMATTER / Option to control whether javadoc comments will have new lines at boundaries + * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" + * - possible values: { TRUE, FALSE } + * - default: TRUE + * + * @see #TRUE + * @see #FALSE + * @since 3.6 + */ + </pre> +<p>For example, the following snippet:</p> +<pre> +public class X { + /* + * This block comment after formatting will no longer use a new line + * at the beginning and at the end of the comment... + */ + void foo() { + } + /** + * This javadoc comment after formatting will no longer use a new line + * at the beginning and at the end of the comment... + */ + void bar() { + } +} +</pre> +formatted with both the options set to FALSE, will produce the following output: +<pre> +public class X { + /* This block comment after formatting will no longer use a new line at the + * beginning and at the end of the comment... */ + void foo() { + } + + /** This javadoc comment after formatting will no longer use a new line at + * the beginning and at the end of the comment... */ + void bar() { + } +} +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270209">270209</a> for more details. +</li> +<li> +The <code>CodeFormatter.F_INCLUDE_COMMENT</code> flag now works for all kind +of snippet while using the formatter.<br> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236406">236406</a> for more details. +</li> +<li> +Added a new formatter preferences to insert a new line after a label. +<p> +This new preference is controlled with the option:</p> +<code>DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL</code> +<pre> +/** + * FORMATTER / Option to insert a new line after a label + * - option id: "org.eclipse.jdt.core.formatter.insert_new_line_after_label" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: DO_NOT_INSERT + * + * @see JavaCore#INSERT + * @see JavaCore#DO_NOT_INSERT + * @since 3.6 + */ +</pre> +<p>For example, the following snippet:</p> +<pre> +public class X { + void foo() { + LABEL:for (int i = 0; i < 10; i++) { + } + } +} +</pre> +formatted with this preference activated, will produce the following output: +<pre> +public class X { + void foo() { + LABEL: + for (int i = 0; i < 10; i++) { + } + } +} +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=150741">150741</a> for more details. +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298362">298362</a> +[1.5][compiler] Compiler returns java.lang.Object instead of generic type T when javac returns T +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281655">281655</a> +[formatter] "Never join lines" does not work for annotations. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282030">282030</a> +[formatter] Java annotation formatting +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270209">270209</a> +[format] Condensed block comment formatting +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236406">236406</a> +[formatter] The comments flags should work for all kinds of snippet +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294360">294360</a> +Duplicate entries in Classpath Resolution when importing dependencies from parent project +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=206391">206391</a> +[DOM] Binding Resolutions for projects outside of Eclipse workspace +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=150409">150409</a> +[compiler] AST does not expose method bindings for non-visible inherited field +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302358">302358</a> +Compiler finds wrong method for method invocation with generics +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302919">302919</a> +misreported cast Error when mixing generic and raw class in nested class +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=150741">150741</a> +[formatter] Add option: "add new line after label" +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287939">287939</a> +[code assist] The instanceof and the auto cast feature should also work for an assignment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=303108">303108</a> +[import rewrite] ImportRewrite#removeImport(String) does not work with setUseContextToFilterImplicitImports(true) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295619">295619</a> +Test failure caused by a timing issue in M20091118-0800 + +<a name="v_A35"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M6 - February 16, 2010 +<br>Project org.eclipse.jdt.core v_A35 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A35">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>In order to fix bugs <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235253">235253</a> and +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=194358">194358</a>, a new API was added to preserve the existing pre-3.6 behavior for existing clients:<br> +<pre> + /** + * Sets whether a context should be used to properly filter implicit imports. + * + * By default, the option is disabled to preserve pre-3.6 behavior. + * + * + * When this option is set, the context passed to the addImport*(...) methods is used to determine + * whether an import can be filtered because the type is implicitly visible. Note that too many imports + * may be kept if this option is set and addImport*(...) methods are called without a context. + * + * + * @param useContextToFilterImplicitImports the given setting + * + * @see #setFilterImplicitImports(boolean) + * @since 3.6 + */ + public void setUseContextToFilterImplicitImports(boolean useContextToFilterImplicitImports); +</pre> +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302455">302455</a> +java.lang.ClassCastException in secondary types removal +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=102279">102279</a> +[search] method reference performance depends on method name +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236814">236814</a> +[jsr199] EclipseCompiler#getTask does not respect its contract when its first argument is null +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302552">302552</a> +[formatter] Formatting qualified invocations can be broken when the Line Wrapping policy forces element to be on a new line +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302587">302587</a> +Encoding/decoding of problem arguments in Marker fails if argument contains # +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=301438">301438</a> +Eclipse hangs when attempting to refactor using the "change method signature" +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=260381">260381</a> +[formatter] Javadoc formatter breaks {@code ...} tags. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302446">302446</a> +[compiler] Regression in if statement flow analysis related to null checks +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=194358">194358</a> +[import rewrite] Organize Imports produces wrong order of imports +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235253">235253</a> +[organize imports] Organize imports removes needed import statement. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302379">302379</a> +[search] JavaSearchTests.testZIPArchive2() test failed in I20100209-0800 + +<a name="v_A34"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M6 - February 9, 2010 +<br>Project org.eclipse.jdt.core v_A34 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A34">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302123">302123</a> +[formatter] AssertionFailedException occurs while formatting a source containing the specific javadoc comment /** ***/ +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379">300379</a> +[formatter] Fup of bug 287833 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=250056">250056</a> +[compiler][null] Another assert and "Redundant null check" +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=301683">301683</a> +Annotations are broken when native methods are present in a class +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300734">300734</a> +Extract temp misses duplicate occurrence. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289560">289560</a> +Eclipse hangs after modifying user libraries +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=301562">301562</a> +[JSR269] Error in EclipseFileManager.collectAllMatchingFiles +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298637">298637</a> +Could not retrieve declared methods (NPE in ParameterizedTypeBinding.resolve) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057">294057</a> +[1.5][compiler] Imports not resolved correctly with generics and inner interfaces + +<a name="v_A33"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M6 - February 2, 2010 +<br>Project org.eclipse.jdt.core v_A33 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A33">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136">300136</a> +classpathentry OPTIONAL attribute not honored for var entries +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300723">300723</a> +Fup of bug 235783 + +<a name="v_A32a"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M5 - January 21, 2010 - 3.6.0 M5 +<br>Project org.eclipse.jdt.core v_A32a +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A32a">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300133">300133</a> +[1.5][compiler] Local classes inside enum constants generate default constructor without implicit constructor call +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=300440">300440</a> +icu dependency needs to be udpated +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=299900">299900</a> +[null]Missing potential null warnings for variable on the right of an OR conditional expression +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293917">293917</a> +Invalid 'potential null access' warning reports +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=252379">252379</a> +Organize imports deletes needed static import. + +<a name="v_A31"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M5 - January 18, 2010 +<br>Project org.eclipse.jdt.core v_A31 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A31">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>New API to fix bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894">295894</a>. See the bug for details. +<pre> +/** + * Returns a Java search scope limited to the hierarchy of the given type and to a given project. + * The Java elements resulting from a search with this scope will be types in this hierarchy. + * + * Unlike the createHierarchyScope methods, this method creates strict + * scopes that only contain types that actually span the hierarchy of the focus + * type, but do not include additional enclosing or member types. + * + * + * By default, hierarchy scopes include all direct and indirect supertypes and subtypes of the + * focus type. This method, however, allows to restrict the hierarchy to true subtypes, + * not including supertypes. Also inclusion of the focus type itself is controled by a parameter. + * + * + * @param project the project to which to constrain the search, or null if + * search should consider all types in the workspace + * @param type the focus of the hierarchy scope + * @param onlySubtypes if true only subtypes of type are considered + * @param includeFocusType if true the focus type type is included in the resulting scope, + * otherwise it is excluded + * @param owner the owner of working copies that take precedence over original compilation units, + * or null if the primary working copy owner should be used + * @return a new hierarchy scope + * @exception JavaModelException if the hierarchy could not be computed on the given type + * @since 3.6 + */ +public static IJavaSearchScope createStrictHierarchyScope(IJavaProject project, IType type, boolean onlySubtypes, boolean includeFocusType, WorkingCopyOwner owner) throws JavaModelException; +</pre> +</li> +<li>New API added to report a compiler warning when object allocations are unused: +<pre> +org.eclipse.jdt.core.compiler.IProblem.UnusedObjectAllocation + +/** + * Compiler option ID: Reporting Allocation of an Unused Object. + * When enabled, the compiler will issue an error or a warning if an object is allocated but never used, + * neither by holding a reference nor by invoking one of the object's methods. + * + * Option id:"org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation" + * Possible values:{ "error", "warning", "ignore" } + * Default:"ignore" + * + * @since 3.6 + * @category CompilerOptionID + */ +public static final String COMPILER_PB_UNUSED_OBJECT_ALLOCATION = PLUGIN_ID + ".compiler.problem.unusedObjectAllocation"; +</pre> +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=245007">245007</a> +[compiler] Should not completely ignore anonymous type with missing super type +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295894">295894</a> +[search] Search shows focus type implementation for nested types even though the scope is restricted to subtypes. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=236385">236385</a> +[compiler] Warn for potential programming problem if an object is created but not used + +<a name="v_A30"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M5 - January 12, 2010 +<br>Project org.eclipse.jdt.core v_A30 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A30">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>New API added to expose the reconcile flags used in the reconcile context: +<pre> +/** + * Returns the reconcile flag of this context. This flag is a bitwise value of the constant defined + * in ICompilationUnit. + * + * @return the reconcile flag of this context + * @since 3.6 + * + * @see ICompilationUnit#ENABLE_BINDINGS_RECOVERY + * @see ICompilationUnit#ENABLE_STATEMENTS_RECOVERY + * @see ICompilationUnit#IGNORE_METHOD_BODIES + */ +public int getReconcileFlags(); +</pre> +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=243917">243917</a> +[compiler] should not warn about unused field when native method present +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296343">296343</a> +OOM error caused by java indexing referencing classloader from threadLocal +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=130000">130000</a> +[API] ReconcileContext API: Does getAST3 return AST with bindings? +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298238">298238</a> +Unresolved import in superclass causes 'Cannot reduce the visibility of the inherited method' in subclass + +<a name="v_A29a"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M5 - January 5, 2010 +<br>Project org.eclipse.jdt.core v_A29a +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A29a">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293861">293861</a> +Problem with refactoring when existing jar with invalid package names +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=264112">264112</a> +[Formatter] Wrap when necessary too aggressive on short qualifiers +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298250">298250</a> +[1.6][compiler] NegativeArraySizeException in StackMapFrame.duplicate +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296998">296998</a> +Unused imports should not prevent execution +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=298243">298243</a> +[formatter] Removing empty lines between import groups +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297546">297546</a> +[formatter] Formatter removes blank after @see if reference is wrapped +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235781">235781</a> +[compiler] difference to javac in definite unassignment analysis involving an exception within a constructor +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235783">235783</a> +[eval] CodeSnippetParser and some 'CodeSnippet*' ast node does not seem up to date + +<a name="v_A28"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M5 - December 14, 2009 +<br>Project org.eclipse.jdt.core v_A28 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A28">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=196714">196714</a> +[comment] InvalidInputException prevents the AbstractCommentMapper to retrieve tag element +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297757">297757</a> +Cannot get bindings for IType corresponding to parameterized anonymous type +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=255640">255640</a> +[spec] Methods Signature.toCharArray(..) have unclear precondition +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=262898">262898</a> +BufferChangedEvent must not have @noinstantiate +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=181682">181682</a> +JavaConventions.validateJavaTypeName should list valid constants +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=108784">108784</a> +SourceMapper doesn't find name range of inner class constructors + +<a name="v_A27"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - December 8, 2009 - 3.6.0 M4 +<br>Project org.eclipse.jdt.core v_A27 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A27">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297225">297225</a> +[formatter] Indentation may be still wrong in certain circumstances after formatting +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293697">293697</a> +JavaSearchBugTests.testBug286379c is failing randomly + +<a name="v_A26"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - December 7, 2009 +<br>Project org.eclipse.jdt.core v_A26 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A26">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=297045">297045</a> +Weird tests failures in N20091204-2000 and N20091205-2000 builds +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293300">293300</a> +[formatter] The formatter is still unstable in certain circumstances + +<a name="v_A25"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - December 4, 2009 +<br>Project org.eclipse.jdt.core v_A25 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A25">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>Match result can now report the access rules through a new API added on <code>TypeNameMatch</code>: +<pre> +/** + * Returns the accessibility of the type name match + * + * @see IAccessRule + * + * @return the accessibility of the type name which may be + * {@link IAccessRule#K_ACCESSIBLE}, {@link IAccessRule#K_DISCOURAGED} + * or {@link IAccessRule#K_NON_ACCESSIBLE}. + * The default returned value is {@link IAccessRule#K_ACCESSIBLE}. + * + * @since 3.6 + */ +public abstract int getAccessibility(); +</pre> +See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296277">296277</a> for more details. +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296277">296277</a> +[search] SearchEngine#searchAllTypeNames(.., TypeNameMatchRequestor,..) should report access rules +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296708">296708</a> +[DOM/AST] clarify setters when createASTs(..) is used +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296629">296629</a> +[quick fix] Cast quick fix not offered for method-local classes +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295948">295948</a> +ElementImpl.hashCode throws an NPE +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=296660">296660</a> +[compiler] Incorrect unused method warning from compiler + +<a name="v_A24"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - December 1, 2009 +<br>Project org.eclipse.jdt.core v_A24 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A24">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>New API added to ignore method bodies inside AST tree. The new APIs are tagged as 3.5.2 as this code +will be backported to 3.5.2: +<pre> +org.eclipse.jdt.core.dom.ASTParser: + /** + * Requests an abstract syntax tree without method bodies. + * + * When ignore method bodies is enabled, all method bodies are discarded. + * This has no impact on the binding resolution. + * + * If a method contains local types, its method body will be retained. + * This settings is not used if the kind used in setKind(int) is either + * K_EXPRESSION or K_STATEMENTS. + * @since 3.5.2 + */ + public void setIgnoreMethodBodies(boolean enabled); + +org.eclipse.jdt.core.ICompilationUnit: + /** + * Constant indicating that a reconcile operation could ignore to parse the method bodies. + * @see ASTParser#setIgnoreMethodBodies(boolean) + * @since 3.5.2 + */ + public static final int IGNORE_METHOD_BODIES = 0x08; + +</pre> +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288174">288174</a> +[search] NullPointerException when searching for type references +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277643">277643</a> +Generics compile error +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288211">288211</a> +APT uses a lot of memory + +<a name="v_A23"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - November 24, 2009 +<br>Project org.eclipse.jdt.core v_A23 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A23">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295698">295698</a> +[1.5][compiler] ClassCastException in unchecked warning report +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295260">295260</a> +Wrong warnings on Java.Compiler.Errors/Warnings "Redundant null check" +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=190737">190737</a> +[compiler][null] missing 'cannot be null' warning within for loop + +<a name="v_A22"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - November 16, 2009 +<br>Project org.eclipse.jdt.core v_A22 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A22">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=153429">153429</a> +JUnit4 in Eclipse Testing Framework +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295238">295238</a> +[formatter] The comment formatter add an unexpected new line in block comment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=295175">295175</a> +[formatter] Missing space before a string at the beginning of a line in a javadoc comment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294529">294529</a> +The Scanner sometimes ignores the given offset if larger than the EOF. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294662">294662</a> +ClassCastException while invoking quick assist +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294404">294404</a> +-target jsr14 flags error on foreach over Collection that does not implement Iterable +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293955">293955</a> +valid javadoc url set on user library, but still says no javadoc +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293443">293443</a> +AbortCompilation when invoking content assist +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293711">293711</a> +Clarify ICompilationUnit#getOwner() javadoc +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293615">293615</a> +error message since v3.6.0M2: name clash by overriding generic methods +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294618">294618</a> +[formatter] The formatter fails to format a compilation unit with deep nesting of html tags +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=248312">248312</a> +[model] IMemberValuePair#getValue() should also work for negative numerals +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294731">294731</a> +Specify value type of JAVADOC_LOCATION_ATTRIBUTE_NAME + +<a name="v_A21"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - November 10, 2009 +<br>Project org.eclipse.jdt.core v_A21 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A21">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294631">294631</a> +[formatter] The formatter takes two passes to format a common sequence of html tags +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294500">294500</a> +[formatter] MalformedTreeException when formatting an invalid sequence of <code> tags in a javadoc comment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=294488">294488</a> +Javadoc of ISourceReference#getSourceRange() should link to SourceRange#isAvailable(..) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=199265">199265</a> +[formatter] 3.3 Code Formatter mis-places commented-out import statements +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=241549">241549</a> +[spec] IType#getFields/Initializers/Methods() should define order from class file +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=275805">275805</a> +creating a non-primary working copy causes typeHierarchyChanged event +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292510">292510</a> +FUP of 292364: Error messages don't identify partial types precisely. + +<a name="v_A20"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M4 - November 3, 2009 +<br>Project org.eclipse.jdt.core v_A20 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A20">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=293384">293384</a> +Eclipse erroneously reports method "is ambiguous for type" +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285002">285002</a> +[compiler] visibility error for package private method + +<a name="v_A19"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - October 29, 2009 - 3.6M3 +<br>Project org.eclipse.jdt.core v_A19 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A19">cvs</a>). +<h2>What's new in this drop</h2> +This version was created to tentatively fix bug <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293697">293697</a> +but it occurs again in subsequent build. So, it has been reopened and moved to next version... + +<h3>Problem Reports Fixed</h3> + +<a name="v_A18"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - October 28, 2009 +<br>Project org.eclipse.jdt.core v_A18 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A18">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293496">293496</a> +Adding the serialVersionUID field doesn't work when tab size is 0 + +<a name="v_A17"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - October 26, 2009 +<br>Project org.eclipse.jdt.core v_A17 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A17">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>Reverted change for bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=263564">263564</a>.</li> +</ul> +<h3>Problem Reports Fixed</h3> + +<a name="v_A16"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - October 25, 2009 +<br>Project org.eclipse.jdt.core v_A16 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A16">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=293240">293240</a> +[formatter] 'insert_space_before_opening_brace_in_array_initializer' preference may be reset in certain circumstances +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=263564">263564</a> +API to know when default compiler preference settings have been altered +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=289385">289385</a> +Investigate comment in performance tests +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=286379">286379</a> +[search] Problem while searching class + +<a name="v_A15"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - October 20, 2009 +<br>Project org.eclipse.jdt.core v_A15 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A15">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=292350">292350</a> +[1.5][compiler] Compiler error: ambiguous method since 3.5.1 using generics and interface inheritance +<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=292364">292364</a> +[internal] Type name in CastExpression not treated as Type name. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292428">292428</a> +Internal compiler error: NullPointerException at org.eclipse.jdt.internal.compiler.ast.CastExpression.checkUnsafeCast(CastExpression.java:333) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291985">291985</a> +[compiler][jsr14] Translating Enum with jsr14 target: ECJ causes a runtime error while Sun compiler works fine +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=292240">292240</a> +Compiler error on implementation of raw sub interface + +<a name="v_A14"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - October 13, 2009 +<br>Project org.eclipse.jdt.core v_A14 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A14">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291391">291391</a> +update the Bundle-Version of the JDT Core Batch Compiler (ecj) from 3.3.0 to 3.6.* +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284280">284280</a> +[1.5][compiler] Error on use generic interface in abstract super class +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286228">286228</a> +[1.5][compiler] Generics inconsistencies possible regression +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286601">286601</a> +[formatter] Code formatter formats anonymous inner classes wrongly when 'Never join lines' is on +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=215139">215139</a> +[search] More options for HierarchyScope +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291472">291472</a> +[1.5][compiler] Access to a generic method is compiled incorrectly +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283539">283539</a> +NamingConventions.suggestVariableNames doesn't work if name contains '_' +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280784">280784</a> +[batch] Allow access restrictions to be reported as errors + +<a name="v_A13"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - October 6, 2009 +<br>Project org.eclipse.jdt.core v_A13 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A13">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>Reverted fix for <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=106478">106478</a>.</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=291322">291322</a> +Test errors when running JDT Core tests on Windows 7 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282770">282770</a> +[compiler] Dead code detection should have specific @SuppressWarnings +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290028">290028</a> +Use IResource#setDerived(boolean, IProgressMonitor) instead of IResource#setDerived(boolean) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287607">287607</a> +[1.5][compiler] cast of inner of generic enclosing type are not reported as unsafe +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288749">288749</a> +Redundant superinterface not flagged inside one declaration +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290905">290905</a> +[formatter] Certain formatter pref constellation cause endless loop ==> OOME +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285124">285124</a> +serialVersionUID still causes error/warning +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290877">290877</a> +[DOM] If using a tag named '@enum' the ASTParser ignores this +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281575">281575</a> +Eclipse hangs in SourceMapper while doing java proposals +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290470">290470</a> +[JSR199][compiler] JDT compiler not jsr199 compatible. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290730">290730</a> +Rewriting SwitchStatement throws NPE + +<a name="v_A12"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - September 29, 2009 +<br>Project org.eclipse.jdt.core v_A12 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A12">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287676">287676</a> +[1.5][compiler] Useless cast warning not emited +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290563">290563</a> +add specification for fine grain search flags +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290376">290376</a> +Errant "Comparing identical expressions" warning with assignment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287592">287592</a> +[1.5][compiler] Wrong ambiguous compilation error +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290049">290049</a> +Reconciling a compilation unit does not return an AST with bindings when it should (probably) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=290034">290034</a> +Effects of @SuppressWarnings("unchecked") are broader in Eclipse than in javac +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267561">267561</a> +[evaluation] LocalEvaluationEngine does not accept primitive types +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=163194">163194</a> +[1.6] compiler should warn about missing @Override annotation for interface method + +<a name="v_A11"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M3 - September 22, 2009 +<br>Project org.eclipse.jdt.core v_A11 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A11">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289892">289892</a> +[compiler] NPE during binaryTypeBinding field initialization +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833">287833</a> +[formatter] Formatter removes the first character after the * in the <pre> tag +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=238943">238943</a> +SortElementsOperation doesn't use project specific settings +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288621">288621</a> +[1.5][compiler] Creating type hierarchy failed when pressing F4 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289538">289538</a> +[1.5][compiler] compiler fails to generate correct code for private constructor in inner class +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289639">289639</a> +Problems opening perspective JavaPerspective, NPE on JavaModelManager.containersReset() +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289516">289516</a> +Annotations (visible and invisible) should be preserved with target jsr14 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289576">289576</a> +[1.5][compiler] Compiler changes 'private' modifier on methods with annotated parameter + +<a name="v_A10"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M2 - September 14, 2009 - 3.6M2 +<br>Project org.eclipse.jdt.core v_A10 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A10">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288148">288148</a> +[perfs] Comments applied for performance tests may be obsolete +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=289247">289247</a> +[1.5][compiler]Detecting duplicate methods should not consider return type +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288920">288920</a> +[compiler] NPE renaming run() method +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=288698">288698</a> +Cannot create type hierarchy for abstract types when they have inline descendants and *.class* in project name + +<a name="v_A09"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M2 - September 1, 2009 +<br>Project org.eclipse.jdt.core v_A09 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A09">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287009">287009</a> +Inner Annotation Checks are Missing +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287701">287701</a> +[dom] Length of Assignment should not include whitespace +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285230">285230</a> +[performance] Duplicate buffers created for internal classes +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286391">286391</a> +[compiler] jsr14 target behavior changed between ECJ 3.4.2 and ECJ 3.5 + +<a name="v_A08"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M2 - August 25, 2009 +<br>Project org.eclipse.jdt.core v_A08 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A08">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287462">287462</a> +[formatter] new failures in last 2 nightly builds +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285565">285565</a> +[inline] Inlining constant or local variables causes exceptions with tab width 0 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285799">285799</a> +HashtableOfObject rehashes and grows buffer on removeKey() +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286912">286912</a> +[formatter] Never join lines preferences makes the formatter unstable in certain circumstances +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286668">286668</a> +[formatter] 'Never Join Lines' joins lines that are split on method invocation +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=248661">248661</a> +Axis2: Missing required libraries in Axis 2 WS Client Projects +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286918">286918</a> +[javadoc] Compiler should warn when @see and @link tag references in package-info.java don't have fully qualified names +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285466">285466</a> +[3.5 regression] fails to build IcedTea, works with 3.4.x +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286956">286956</a> +NPE when asking to externalize constant +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281609">281609</a> +[javadoc] "Javadoc: Invalid reference" warning for @link to Java package + +<a name="v_A07"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M2 - August 18, 2009 +<br>Project org.eclipse.jdt.core v_A07 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A07">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286840">286840</a> +ClasspathJar getPath() should return a unique path +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=254738">254738</a> +NPE in HierarchyResolver.setFocusType +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276294">276294</a> +Error does not go away after it is resolved +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284785">284785</a> +[1.5][compiler] Eclipse compiler shows error on javac-valid construct: varargs plus overload +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286405">286405</a> +Default value character of annotations in ClassFileEditor are badly printed +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=286407">286407</a> +[Model] IMemberValuePair don't return the right value for java.lang.annotation.RetentionPolicy annotations +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=285701">285701</a> +[1.5][compiler] Internal Compiler Error - ArrayIndexOutOfBoundsException + +<a name="v_A06"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M1 - August 3, 2009 - 3.6M1 +<br>Project org.eclipse.jdt.core v_A06 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A06">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284948">284948</a> +[1.6][compiler] Java annotations are broken in editor when used on interface methods + +<a name="v_A05"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M1 - July 30, 2009 +<br>Project org.eclipse.jdt.core v_A05 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A05">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276526">276526</a> +[content assist] Error - Type Duplicate interface Iterable for the type TestClass +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=191176">191176</a> +JavaProject#getOption optimizations + +<a name="v_A04"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M1 - July 28, 2009 +<br>Project org.eclipse.jdt.core v_A04 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A04">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=261909">261909</a> +ClassFileReader.getModifiers() answers funny bits +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283225">283225</a> +[1.6][compiler] classfile versus source conformance check too strict +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284679">284679</a> +[formatter] empty single semi statement prevent enum elements format +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284482">284482</a> +[compiler] Collision cases not detected +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=284431">284431</a> +Different inherited thrown exception clauses are not properly handled +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=133911">133911</a> +type.move() returns unclear exception "invalid destination" +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270436">270436</a> +[assist] Interface type proposed where only class is legal +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=210385">210385</a> +[compiler] ProblemReporter#getProblemCategory misbehaves when passed ProblemSeverities.Ignore as severity parameter +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282891">282891</a> +[compiler] "Comparing identical expressions" warning sometimes invalid +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282869">282869</a> +[compiler] Unnecessary cast warning for cast from char to int +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=270437">270437</a> +[assist] Completion proposal leads to cycle detected error +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=217443">217443</a> +Documentation for JavaCore#CORE_ENCODING does not match the observed behavior + +<a name="v_A03"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M1 - July 21, 2009 +<br>Project org.eclipse.jdt.core v_A03 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A03">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283467">283467</a> +[formatter] wrong indentation with 'Never join lines' selected +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281776">281776</a> +Should not warn for comparison of identical expression with float type +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282768">282768</a> +[compiler] Dead code detection should ignore trivial case for ternary if operator +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283133">283133</a> +[formatter] IAE when pasting a snippet +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=283299">283299</a> +Complete SourceRange API + +<a name="v_A02"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java Development Tooling Core</h1> +Eclipse SDK 3.6M1 - July 13, 2009 +<br>Project org.eclipse.jdt.core v_A02 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A02">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>Added new API type org.eclipse.jdt.core.SourceRange</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=271296">271296</a> +[assist] void typed proposal may not be appropriate in many contexts +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281871">281871</a> +[content assist] The extension took too long to return from the 'computeCompletionProposals()' operation +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281598">281598</a> +[assist] Problems during content assist - if project has empty zip file in classpath +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235294">235294</a> +[formatter] javadoc for DefaultCodeFormatterConstants#FORMATTER_ALIGNMENT_FOR_ASSIGNMENT cites a non-API constant +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280497">280497</a> +Incorrect null result for IJavaProject.getClasspathEntryFor(IPath) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=204777">204777</a> +Clarify documentation for ITypeHierarchy created on interface types +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=88265">88265</a> +Make SourceRange API + +<a name="v_A01"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M1 - July 7, 2009 +<br>Project org.eclipse.jdt.core v_A01 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A01">cvs</a>). +<h2>What's new in this drop</h2> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=260968">260968</a> +Deadlock in UserLibraryManager + +<a name="v_A00"></a> +<hr><h1> +Eclipse Platform Build Notes<br> +Java development tools core</h1> +Eclipse SDK 3.6M1 - June 30, 2009 +<br>Project org.eclipse.jdt.core v_A00 +(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A00">cvs</a>). +<h2>What's new in this drop</h2> +<ul> +<li>New API added to handle the new <code>invokedynamic</code> bytecode: +<pre> +org.eclipse.jdt.core.util.ByteCodeVisitorAdapter: + public void _invokedynamic( + int pc, + int index, + IConstantPoolEntry nameEntry, + IConstantPoolEntry descriptorEntry) { + // default behavior is to do nothing + } +</pre> +<pre>org.eclipse.jdt.core.util.IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry, IConstantPoolEntry)</pre> +<pre>org.eclipse.jdt.core.util.IOpcodeMnemonics#INVOKEDYNAMIC</pre> +</li> +</ul> + +<h3>Problem Reports Fixed</h3> +<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277450">277450</a> +[1.5][compiler] Problems with += and Autoboxing/Unboxing +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=206498">206498</a> +[1.7][compiler] Remove fix for bug 206483 once 1.7 VMS can handle .class files with version 51.0 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=191176">191176</a> +JavaProject#getOption optimizations +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=201762">201762</a> +Content Assist has no proposals with certain CU structure +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281681">281681</a> +Stale code in CompilerOptions +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=231796">231796</a> +[formatter] @throws tag description is not indented using @param preference when there's a syntax error +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=255142">255142</a> +[select] Codeselect should not omit cast +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=235295">235295</a> +[formatter] javadoc of CodeFormatter#F_INCLUDE_COMMENTS needs improvement +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280134">280134</a> +[1.5][compiler] Requesting Java AST from selection has encountered a problem +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=281317">281317</a> +[search] An internal error occurred during: "Java Search". +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276373">276373</a> +Incorrect resource comparison with IJavaProject.isOnClasspath(IResource) +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=275518">275518</a> +[assist] Content assist does not provide proposals if invoked right after a method's opening brace +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280888">280888</a> +change a java file in one plug-in will compile all related plugin projects +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=274466">274466</a> +[assist] Assert expressions should be proposed with high relevance +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277382">277382</a> +NPE and other failures in Parser +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=275330">275330</a> +NPE from org.eclipse.jdt.internal.core.ClasspathChange.requestIndexing +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=273385">273385</a> +[model] NPE while closing project +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280079">280079</a> +NPE while parsing K_CLASS_BODY_DECLARATIONS +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280063">280063</a> +org.eclipse.jdt.internal.compiler.parser.Parser.parseClassBodyDeclarations(char[], int, int, CompilationUnitDeclaration) should return consistent results +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267046">267046</a> +SourceMapper infinite loop on primitive type in generic +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=240934">240934</a> +Add support for the invokedynamic bytecode into the disassembler +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=267551">267551</a> +[formatter] Wrong spacing in default array parameter for annotation type +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277965">277965</a> +[compiler] NPE in canBeSeenBy due to illegal protected toplevel class +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=273990">273990</a> +[compiler] FUP of 269388: Eclipse accepts code rejected by javac +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=279183">279183</a> +[1.6][compiler] Inconsistent stackmap frames generated by JDT cause VerifyError +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=209778">209778</a> +[search] TypeReferenceMatch#getOtherElements() fails for match in annotation +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=221065">221065</a> +[search] Search still finds overridden method +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836">279836</a> +[1.5][compiler] Eclipse compiler shows error on javac-valid construct: raw types on overridden methods +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280616">280616</a> +[formatter] Valid 1.5 code is not formatted inside <pre> tag +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280255">280255</a> +[formatter] Format edited lines adds two new lines on each save +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=280061">280061</a> +[formatter] AIOOBE while formatting javadoc comment +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276938">276938</a> +Remove unreachable removes reachable logic in case statement. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=274898">274898</a> +[recovery] IllegalArgumentException in ASTNode#setSourceRange() +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=277204">277204</a> +IAE in SharedASTProvider for generic local class. +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276741">276741</a> +comparing identical value detection does not work for this +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=276740">276740</a> +comparing identical value detection does not work for primitive types +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=278745">278745</a> +Methods overloaded with unavailable types worked in 3.4 but give "indirectly referenced.." error in 3.5 +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=278305">278305</a> +[1.5][compiler] JDT accepts supertype parameterized with wildcard +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=196308">196308</a> +[formatter] Don't escape entity when formatting in <pre> tags within javadoc comments +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=279359">279359</a> +[formatter] Formatter with 'never join lines' produces extra level of indent +<br><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=273619">273619</a> +[formatter] Formatting repeats *} in javadoc + +<hr> +<p>For earlier build notes, also see <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/R35_buildnotes_jdt-core.html">build notes up to Release 3.5</a>.</p> +<br> + <p> + <a href="http://validator.w3.org/check?uri=referer"><img + src="http://www.w3.org/Icons/valid-html401" + alt="Valid HTML 4.01 Transitional" height="31" width="88"></a> + </p> +</body> +</html> + diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java index 153a42718..b034b6fbb 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -49,6 +49,8 @@ import org.eclipse.jdt.internal.core.search.indexing.IndexManager; */ public abstract class SearchParticipant { + private IPath lastIndexLocation; + /** * Creates a new search participant. */ @@ -205,6 +207,10 @@ public abstract class SearchParticipant { // TODO (frederic) should not have to create index manually, should expose API that recreates index instead manager.ensureIndexExists(indexLocation, containerPath); manager.scheduleDocumentIndexing(document, containerPath, indexLocation, this); + if (!indexLocation.equals(this.lastIndexLocation)) { + manager.updateParticipant(indexLocation, containerPath); + this.lastIndexLocation = indexLocation; + } } /** diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java index d267925eb..3f829b471 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java @@ -17,6 +17,7 @@ import org.eclipse.jdt.core.*; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.search.IJavaSearchScope; import org.eclipse.jdt.core.search.SearchPattern; +import org.eclipse.jdt.internal.compiler.util.ObjectVector; import org.eclipse.jdt.internal.compiler.util.SimpleSet; import org.eclipse.jdt.internal.core.JarPackageFragmentRoot; import org.eclipse.jdt.internal.core.JavaModel; @@ -53,7 +54,7 @@ public static boolean canSeeFocus(SearchPattern pattern, IPath projectOrJarPath) try { IJavaModel model = JavaModelManager.getJavaModelManager().getJavaModel(); IJavaProject project = getJavaProject(projectOrJarPath, model); - IJavaElement[] focuses = getFocusedElements(pattern, project); + IJavaElement[] focuses = getFocusedElementsAndTypes(pattern, project, null); if (focuses.length == 0) return false; if (project != null) { return canSeeFocus(focuses, (JavaProject) project, null); @@ -76,14 +77,14 @@ public static boolean canSeeFocus(SearchPattern pattern, IPath projectOrJarPath) return false; } } -private static boolean canSeeFocus(IJavaElement[] focuses, JavaProject javaProject, char[][] focusQualifiedName) { +private static boolean canSeeFocus(IJavaElement[] focuses, JavaProject javaProject, char[][][] focusQualifiedNames) { int length = focuses.length; for (int i=0; i<length; i++) { - if (canSeeFocus(focuses[i], javaProject, focusQualifiedName)) return true; + if (canSeeFocus(focuses[i], javaProject, focusQualifiedNames)) return true; } return false; } -private static boolean canSeeFocus(IJavaElement focus, JavaProject javaProject, char[][] focusQualifiedName) { +private static boolean canSeeFocus(IJavaElement focus, JavaProject javaProject, char[][][] focusQualifiedNames) { try { if (focus == null) return false; if (focus.equals(javaProject)) return true; @@ -105,7 +106,7 @@ private static boolean canSeeFocus(IJavaElement focus, JavaProject javaProject, for (int i = 0, length = entries.length; i < length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT && entry.getPath().equals(focusPath)) { - if (focusQualifiedName != null) { // builder state is usable, hence use it to try to reduce project which can see the focus... + if (focusQualifiedNames != null) { // builder state is usable, hence use it to try to reduce project which can see the focus... State projectState = (State) JavaModelManager.getJavaModelManager().getLastBuiltState(javaProject.getProject(), null); if (projectState != null) { Object[] values = projectState.getReferences().valueTable; @@ -113,7 +114,7 @@ private static boolean canSeeFocus(IJavaElement focus, JavaProject javaProject, for (int j=0; j<vLength; j++) { if (values[j] == null) continue; ReferenceCollection references = (ReferenceCollection) values[j]; - if (references.includes(focusQualifiedName)) { + if (references.includes(focusQualifiedNames, null, null)) { return true; } } @@ -132,7 +133,7 @@ private static boolean canSeeFocus(IJavaElement focus, JavaProject javaProject, /* * Create the list of focused jars or projects. */ -private static IJavaElement[] getFocusedElements(SearchPattern pattern, IJavaElement focusElement) throws JavaModelException { +private static IJavaElement[] getFocusedElementsAndTypes(SearchPattern pattern, IJavaElement focusElement, ObjectVector superTypes) throws JavaModelException { if (pattern instanceof MethodPattern) { // For method pattern, it needs to walk along the focus type super hierarchy // and add jars/projects of all the encountered types. @@ -153,6 +154,8 @@ private static IJavaElement[] getFocusedElements(SearchPattern pattern, IJavaEle IPackageFragmentRoot root = (IPackageFragmentRoot) allTypes[i].getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); IJavaElement element = root.isArchive() ? root : root.getParent(); focusSet.add(element); + if (superTypes != null) superTypes.add(allTypes[i]); + break; } } } @@ -190,37 +193,27 @@ private void initializeIndexLocations() { } else { try { // See whether the state builder might be used to reduce the number of index locations - boolean isAutoBuilding = ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding(); - char[][] focusQualifiedName = null; - if (isAutoBuilding && focus instanceof IJavaProject) { - IJavaElement javaElement = this.pattern.focus; - while (javaElement != null && !(javaElement instanceof ITypeRoot)) { - javaElement = javaElement.getParent(); - } - if (javaElement != null) { - IType primaryType = ((ITypeRoot) javaElement).findPrimaryType(); - if (primaryType != null) { - char[][] qualifiedName = CharOperation.splitOn('.', primaryType.getFullyQualifiedName().toCharArray()); - char[][][] qualifiedNames = ReferenceCollection.internQualifiedNames(new char[][][] {qualifiedName}); - focusQualifiedName = qualifiedNames.length == 0 ? qualifiedName : qualifiedNames[0]; - } - } - } - + // find the projects from projectsAndJars that see the focus then walk those projects looking for the jars from projectsAndJars int length = projectsAndJars.length; JavaProject[] projectsCanSeeFocus = new JavaProject[length]; SimpleSet visitedProjects = new SimpleSet(length); int projectIndex = 0; SimpleSet externalLibsToCheck = new SimpleSet(length); - IJavaElement[] focuses = getFocusedElements(this.pattern, focus); + ObjectVector superTypes = new ObjectVector(); + IJavaElement[] focuses = getFocusedElementsAndTypes(this.pattern, focus, superTypes); + char[][][] focusQualifiedNames = null; + boolean isAutoBuilding = ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding(); + if (isAutoBuilding && focus instanceof IJavaProject) { + focusQualifiedNames = getQualifiedNames(superTypes); + } IJavaModel model = JavaModelManager.getJavaModelManager().getJavaModel(); for (int i = 0; i < length; i++) { IPath path = projectsAndJars[i]; JavaProject project = (JavaProject) getJavaProject(path, model); if (project != null) { visitedProjects.add(project); - if (canSeeFocus(focuses, project, focusQualifiedName)) { + if (canSeeFocus(focuses, project, focusQualifiedNames)) { locations.add(manager.computeIndexLocation(path)); projectsCanSeeFocus[projectIndex++] = project; } @@ -296,4 +289,24 @@ private static IJavaProject getJavaProject(IPath path, IJavaModel model) { } return null; } + +private char[][][] getQualifiedNames(ObjectVector types) { + final int size = types.size; + char[][][] focusQualifiedNames = null; + IJavaElement javaElement = this.pattern.focus; + while (javaElement != null && !(javaElement instanceof ITypeRoot)) { + javaElement = javaElement.getParent(); + } + if (javaElement != null) { + IType primaryType = ((ITypeRoot) javaElement).findPrimaryType(); + if (primaryType != null) { + focusQualifiedNames = new char[size+1][][]; + focusQualifiedNames[0] = CharOperation.splitOn('.', primaryType.getFullyQualifiedName().toCharArray()); + } + } + for (int i = 0; i < size; i++) { + focusQualifiedNames[i+1] = CharOperation.splitOn('.', ((IType)(types.elementAt(i))).getFullyQualifiedName().toCharArray()); + } + return focusQualifiedNames == null ? null : ReferenceCollection.internQualifiedNames(focusQualifiedNames, true); +} } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java index 9c345a619..d16ad3686 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -88,7 +88,9 @@ public String getJobFamily() { public boolean search(Index index, IProgressMonitor progressMonitor) { if (index == null) return COMPLETE; if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException(); - + if (!MatchLocator.SHOULD_FILTER_ENUM && index.containerPath.indexOf("org.apache.commons.lang_2") != -1) { //$NON-NLS-1$ + MatchLocator.SHOULD_FILTER_ENUM = true; + } ReadWriteMonitor monitor = index.monitor; if (monitor == null) return COMPLETE; // index got deleted since acquired try { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java index e2787401a..59e00a45e 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -16,6 +16,7 @@ import org.eclipse.jdt.core.IAccessRule; import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.IType; @@ -25,9 +26,12 @@ import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.search.IJavaSearchScope; import org.eclipse.jdt.core.search.TypeNameMatchRequestor; import org.eclipse.jdt.core.search.TypeNameRequestor; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.AccessRestriction; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.core.Openable; import org.eclipse.jdt.internal.core.PackageFragmentRoot; +import org.eclipse.jdt.internal.core.search.matching.MatchLocator; import org.eclipse.jdt.internal.core.util.HandleFactory; import org.eclipse.jdt.internal.core.util.HashtableOfArrayToObject; @@ -69,6 +73,8 @@ public class TypeNameMatchRequestorWrapper implements IRestrictedAccessTypeReque * Cache package handles to optimize memory. */ private HashtableOfArrayToObject packageHandles; + private Object lastProject; + private long complianceValue; public TypeNameMatchRequestorWrapper(TypeNameMatchRequestor requestor, IJavaSearchScope scope) { this.requestor = requestor; @@ -168,6 +174,18 @@ private IType createTypeFromJar(String resourcePath, int separatorIndex) throws IPackageFragment pkgFragment= (IPackageFragment) this.packageHandles.get(pkgName); if (pkgFragment == null) { pkgFragment= ((PackageFragmentRoot) this.lastPkgFragmentRoot).getPackageFragment(pkgName); + // filter org.apache.commons.lang.enum package for projects above 1.5 + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264 + if (MatchLocator.SHOULD_FILTER_ENUM && length == 5 && pkgName[4].equals("enum")) { //$NON-NLS-1$ + IJavaProject proj = (IJavaProject)pkgFragment.getAncestor(IJavaElement.JAVA_PROJECT); + if (!proj.equals(this.lastProject)) { + String complianceStr = proj.getOption(CompilerOptions.OPTION_Source, true); + this.complianceValue = CompilerOptions.versionToJdkLevel(complianceStr); + this.lastProject = proj; + } + if (this.complianceValue >= ClassFileConstants.JDK1_5) + return null; + } this.packageHandles.put(pkgName, pkgFragment); } return pkgFragment.getClassFile(simpleNames[length]).getType(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java index b615bd5de..5c7af3e65 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java @@ -53,11 +53,16 @@ public class IndexManager extends JobManager implements IIndexConstants { // key = indexLocation path, value = index state integer private SimpleLookupTable indexStates = null; private File savedIndexNamesFile = new File(getSavedIndexesDirectory(), "savedIndexNames.txt"); //$NON-NLS-1$ + private File participantIndexNamesFile = new File(getSavedIndexesDirectory(), "participantsIndexNames.txt"); //$NON-NLS-1$ private boolean javaLikeNamesChanged = true; public static final Integer SAVED_STATE = new Integer(0); public static final Integer UPDATING_STATE = new Integer(1); public static final Integer UNKNOWN_STATE = new Integer(2); public static final Integer REBUILDING_STATE = new Integer(3); + + // search participants who register indexes with the index manager + private SimpleLookupTable participantsContainers = null; + private boolean participantUpdated = false; // Debug public static boolean DEBUG = false; @@ -129,7 +134,7 @@ public void cleanUpIndexes() { } deleteIndexFiles(knownPaths); } -public IPath computeIndexLocation(IPath containerPath) { +public synchronized IPath computeIndexLocation(IPath containerPath) { IPath indexLocation = (IPath) this.indexLocations.get(containerPath); if (indexLocation == null) { String pathString = containerPath.toOSString(); @@ -168,7 +173,7 @@ private void deleteIndexFiles(SimpleSet pathsToKeep) { /* * Creates an empty index at the given location, for the given container path, if none exist. */ -public void ensureIndexExists(IPath indexLocation, IPath containerPath) { +public synchronized void ensureIndexExists(IPath indexLocation, IPath containerPath) { SimpleLookupTable states = getIndexStates(); Object state = states.get(indexLocation); if (state == null) { @@ -324,6 +329,20 @@ public Index[] getIndexes(IPath[] locations, IProgressMonitor progressMonitor) { rebuildIndex(indexLocation, containerPath); index = null; } + } else { + if (!getJavaPluginWorkingLocation().isPrefixOf(indexLocation)) { // the index belongs to non-jdt search participant + if (indexLocation.toFile().exists()) { + try { + IPath container = getParticipantsContainer(indexLocation); + if (container != null) { + index = new Index(indexLocation.toOSString(), container.toOSString(), true /*reuse index file*/); + this.indexes.put(indexLocation, index); + } + } catch (IOException e) { + // ignore + } + } + } } } if (index != null) @@ -370,6 +389,12 @@ private SimpleLookupTable getIndexStates() { } return this.indexStates; } +private IPath getParticipantsContainer(IPath indexLocation) { + if (this.participantsContainers == null) { + readParticipantsIndexNamesFile(); + } + return (IPath)this.participantsContainers.get(indexLocation); +} private IPath getJavaPluginWorkingLocation() { if (this.javaPluginLocation != null) return this.javaPluginLocation; @@ -661,6 +686,10 @@ public synchronized void removeIndexPath(IPath path) { for (int i = 0; i < count; i++) this.indexes.removeKey(locations[i]); removeIndexesState(locations); + if (this.participantsContainers != null && this.participantsContainers.get(path.toOSString()) != null) { + this.participantsContainers.removeKey(path.toOSString()); + writeParticipantsIndexNamesFile(); + } } } /** @@ -802,6 +831,10 @@ public void saveIndexes() { monitor.exitRead(); } } + if (this.participantsContainers != null && this.participantUpdated) { + writeParticipantsIndexNamesFile(); + this.participantUpdated = false; + } this.needToSave = !allSaved; } public void scheduleDocumentIndexing(final SearchDocument searchDocument, IPath container, final IPath indexLocation, final SearchParticipant searchParticipant) { @@ -861,6 +894,28 @@ private char[][] readIndexState(String dirOSString) { } return null; } +private void readParticipantsIndexNamesFile() { + SimpleLookupTable containers = new SimpleLookupTable(3); + try { + char[] participantIndexNames = org.eclipse.jdt.internal.compiler.util.Util.getFileCharContent(this.participantIndexNamesFile, null); + if (participantIndexNames.length > 0) { + char[][] names = CharOperation.splitOn('\n', participantIndexNames); + if (names.length >= 3) { + // First line is DiskIndex signature (see writeParticipantsIndexNamesFile()) + if (DiskIndex.SIGNATURE.equals(new String(names[0]))) { + for (int i = 1, l = names.length-1 ; i < l ; i+=2) { + containers.put(new Path(new String(names[i])), new Path(new String(names[i+1]))); + } + } + } + } + } catch (IOException ignored) { + if (VERBOSE) + Util.verbose("Failed to read participant index file names"); //$NON-NLS-1$ + } + this.participantsContainers = containers; + return; +} private synchronized void removeIndexesState(IPath[] locations) { getIndexStates(); // ensure the states are initialized int length = locations.length; @@ -907,6 +962,15 @@ private synchronized void updateIndexState(IPath indexLocation, Integer indexSta } } +public void updateParticipant(IPath indexLocation, IPath containerPath) { + if (this.participantsContainers == null) { + readParticipantsIndexNamesFile(); + } + if (this.participantsContainers.get(indexLocation) == null) { + this.participantsContainers.put(indexLocation, containerPath); + this.participantUpdated = true; + } +} private void writeJavaLikeNamesFile() { BufferedWriter writer = null; String pathName = getJavaPluginWorkingLocation().toOSString(); @@ -941,6 +1005,36 @@ private void writeJavaLikeNamesFile() { } } } +private void writeParticipantsIndexNamesFile() { + BufferedWriter writer = null; + try { + writer = new BufferedWriter(new FileWriter(this.participantIndexNamesFile)); + writer.write(DiskIndex.SIGNATURE); + writer.write('\n'); + Object[] indexFiles = this.participantsContainers.keyTable; + Object[] containers = this.participantsContainers.valueTable; + for (int i = 0, l = indexFiles.length; i < l; i++) { + IPath indexFile = (IPath)indexFiles[i]; + if (indexFile != null) { + writer.write(indexFile.toOSString()); + writer.write('\n'); + writer.write(((IPath)containers[i]).toOSString()); + writer.write('\n'); + } + } + } catch (IOException ignored) { + if (VERBOSE) + Util.verbose("Failed to write participant index file names", System.err); //$NON-NLS-1$ + } finally { + if (writer != null) { + try { + writer.close(); + } catch (IOException e) { + // ignore + } + } + } +} private void writeSavedIndexNamesFile() { BufferedWriter writer = null; try { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java index 7bf82eaf8..f279d55cb 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -79,9 +79,9 @@ public void acceptFieldReference(char[] fieldName, int sourcePosition) { this.indexer.addFieldReference(fieldName); } /** - * @see ISourceElementRequestor#acceptImport(int, int, char[][], boolean, int) + * @see ISourceElementRequestor#acceptImport(int, int, int, int, char[][], boolean, int) */ -public void acceptImport(int declarationStart, int declarationEnd, char[][] tokens, boolean onDemand, int modifiers) { +public void acceptImport(int declarationStart, int declarationEnd, int nameStart, int nameEnd, char[][] tokens, boolean onDemand, int modifiers) { // imports have already been reported while creating the ImportRef node (see SourceElementParser#comsume*ImportDeclarationName() methods) } /** diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndLocator.java index 73e0f92e0..592c6bcab 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndLocator.java @@ -255,4 +255,13 @@ public int resolveLevel(Binding binding) { } return level; } +/* (non-Javadoc) + * @see org.eclipse.jdt.internal.core.search.matching.PatternLocator#setFlavors(int) + */ +void setFlavors(int flavors) { + for (int i = 0, length = this.patternLocators.length; i < length; i++) { + this.patternLocators[i].setFlavors(flavors); + } +} + } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java index 4e0cd9642..c7ff0bf76 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java @@ -136,6 +136,7 @@ import org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transfor public class MatchLocator implements ITypeRequestor { public static final int MAX_AT_ONCE; +public static boolean SHOULD_FILTER_ENUM = false; static { long maxMemory = Runtime.getRuntime().maxMemory(); int ratio = (int) Math.round(((double) maxMemory) / (64 * 0x100000)); @@ -664,7 +665,9 @@ protected IJavaElement createHandle(AbstractVariableDeclaration variableDeclarat variableDeclaration.sourceStart, variableDeclaration.sourceEnd, new String(variableDeclaration.type.resolvedType.signature()), - variableDeclaration.annotations + variableDeclaration.annotations, + variableDeclaration.modifiers, + false ); } break; @@ -677,7 +680,9 @@ protected IJavaElement createHandle(AbstractVariableDeclaration variableDeclarat variableDeclaration.sourceStart, variableDeclaration.sourceEnd, new String(variableDeclaration.type.resolvedType.signature()), - variableDeclaration.annotations + variableDeclaration.annotations, + variableDeclaration.modifiers, + true ); } break; @@ -826,6 +831,28 @@ public boolean encloses(IJavaElement element) { } return false; } +private boolean filterEnum(SearchMatch match) { + + // filter org.apache.commons.lang.enum package for projects above 1.5 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=317264 + IJavaElement element = (IJavaElement)match.getElement(); + PackageFragment pkg = (PackageFragment)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT); + if (pkg != null) { + // enum was found in org.apache.commons.lang.enum at index 5 + if (pkg.names.length == 5 && pkg.names[4].equals("enum")) { //$NON-NLS-1$ + if (this.options == null) { + IJavaProject proj = (IJavaProject)pkg.getAncestor(IJavaElement.JAVA_PROJECT); + String complianceStr = proj.getOption(CompilerOptions.OPTION_Source, true); + if (CompilerOptions.versionToJdkLevel(complianceStr) >= ClassFileConstants.JDK1_5) + return true; + } else if (this.options.sourceLevel >= ClassFileConstants.JDK1_5) { + return true; + } + } + } + return false; +} + /* (non-Javadoc) * Return info about last type argument of a parameterized type reference. * These info are made of concatenation of 2 int values which are respectively @@ -1875,6 +1902,12 @@ public void report(SearchMatch match) throws CoreException { } return; } + if (MatchLocator.SHOULD_FILTER_ENUM && filterEnum(match)){ + if (BasicSearchEngine.VERBOSE) { + System.out.println("Filtered package with name enum"); //$NON-NLS-1$ + } + return; + } long start = -1; if (BasicSearchEngine.VERBOSE) { start = System.currentTimeMillis(); diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java index 26dfac415..ec810efae 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java @@ -306,11 +306,13 @@ protected void consumeCastExpressionWithQualifiedGenericsArray() { } protected void consumeClassHeaderExtends() { + this.patternLocator.setFlavors(PatternLocator.SUPERTYPE_REF_FLAVOR); super.consumeClassHeaderExtends(); if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { TypeDeclaration typeDeclaration = (TypeDeclaration) this.astStack[this.astPtr]; this.patternLocator.match(typeDeclaration.superclass, this.nodeSet); } + this.patternLocator.setFlavors(PatternLocator.NO_FLAVOR); } protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() { @@ -333,6 +335,12 @@ protected void consumeClassInstanceCreationExpressionWithTypeArguments() { } } +protected void consumeEnterAnonymousClassBody(boolean qualified) { + this.patternLocator.setFlavors(PatternLocator.SUPERTYPE_REF_FLAVOR); + super.consumeEnterAnonymousClassBody(qualified); + this.patternLocator.setFlavors(PatternLocator.NO_FLAVOR); +} + protected void consumeEnterVariable() { boolean isLocalDeclaration = this.nestedMethod[this.nestedType] != 0; super.consumeEnterVariable(); @@ -387,11 +395,13 @@ protected void consumeInstanceOfExpressionWithName() { } } protected void consumeInterfaceType() { + this.patternLocator.setFlavors(PatternLocator.SUPERTYPE_REF_FLAVOR); super.consumeInterfaceType(); if ((this.patternFineGrain & IJavaSearchConstants.SUPERTYPE_TYPE_REFERENCE) != 0) { TypeReference typeReference = (TypeReference) this.astStack[this.astPtr]; this.patternLocator.match(typeReference, this.nodeSet); } + this.patternLocator.setFlavors(PatternLocator.NO_FLAVOR); } protected void consumeLocalVariableDeclaration() { diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java index 6a26f3a28..e3f7b0073 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2010 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 @@ -780,7 +780,7 @@ public int resolveLevel(Binding binding) { int declaringLevel = subType ? resolveLevelAsSubtype(qualifiedPattern, method.declaringClass, null) : resolveLevelForType(qualifiedPattern, method.declaringClass); - return methodLevel > declaringLevel ? declaringLevel : methodLevel; // return the weaker match + return (methodLevel & MATCH_LEVEL_MASK) > (declaringLevel & MATCH_LEVEL_MASK) ? declaringLevel : methodLevel; // return the weaker match } protected int resolveLevel(MessageSend messageSend) { MethodBinding method = messageSend.binding; @@ -843,7 +843,7 @@ protected int resolveLevel(MessageSend messageSend) { } else { declaringLevel = resolveLevelForType(qualifiedPattern, method.declaringClass); } - return methodLevel > declaringLevel ? declaringLevel : methodLevel; // return the weaker match + return (methodLevel & MATCH_LEVEL_MASK) > (declaringLevel & MATCH_LEVEL_MASK) ? declaringLevel : methodLevel; // return the weaker match } /** diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java index 8bfd6d872..9ccd35bd0 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java @@ -403,4 +403,13 @@ public int resolveLevel(Binding binding) { } return level; } +/* (non-Javadoc) + * @see org.eclipse.jdt.internal.core.search.matching.PatternLocator#setFlavors(int) + */ +void setFlavors(int flavors) { + for (int i = 0, length = this.patternLocators.length; i < length; i++) { + this.patternLocators[i].setFlavors(flavors); + } +} + } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java index 0cc0ed607..f4d57cf32 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java @@ -56,7 +56,9 @@ public static final int ACCURATE_MATCH = 3; public static final int ERASURE_MATCH = 4; // Possible rule match flavors +int flavors = 0; // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=79866 +public static final int NO_FLAVOR = 0x0000; public static final int EXACT_FLAVOR = 0x0010; public static final int PREFIX_FLAVOR = 0x0020; public static final int PATTERN_FLAVOR = 0x0040; @@ -65,6 +67,7 @@ public static final int CAMELCASE_FLAVOR = 0x0100; public static final int SUPER_INVOCATION_FLAVOR = 0x0200; public static final int SUB_INVOCATION_FLAVOR = 0x0400; public static final int OVERRIDDEN_METHOD_FLAVOR = 0x0800; +public static final int SUPERTYPE_REF_FLAVOR = 0x1000; public static final int MATCH_LEVEL_MASK = 0x0F; public static final int FLAVORS_MASK = ~MATCH_LEVEL_MASK; @@ -505,6 +508,17 @@ public int resolveLevel(ASTNode possibleMatchingNode) { // need to do instance of checks to find out exact type of ASTNode return IMPOSSIBLE_MATCH; } +/** + * Set the flavors for which the locator has to be focused on. + * If not set, the locator will accept all matches with or without flavors. + * When set, the locator will only accept match having the corresponding flavors. + * + * @param flavors Bits mask specifying the flavors to be accepted or + * <code>0</code> to ignore the flavors while accepting matches. + */ +void setFlavors(int flavors) { + this.flavors = flavors; +} /* * Update pattern locator match for parameterized top level types. * Set match raw flag and recurse to enclosing types if any... diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java index 667cb8324..0bc954ec7 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java @@ -36,6 +36,7 @@ public SuperTypeReferenceLocator(SuperTypeReferencePattern pattern) { //public int match(Reference node, MatchingNodeSet nodeSet) - SKIP IT //public int match(TypeDeclaration node, MatchingNodeSet nodeSet) - SKIP IT public int match(TypeReference node, MatchingNodeSet nodeSet) { + if (this.flavors != SUPERTYPE_REF_FLAVOR) return IMPOSSIBLE_MATCH; if (this.pattern.superSimpleName == null) return nodeSet.addMatch(node, this.pattern.mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH); |