Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2011-10-25 16:30:31 +0000
committerStephan Herrmann2011-10-25 16:30:31 +0000
commit6dcbb38068eee59acb310076b78bc9a8183f88b8 (patch)
tree5970dc8f2ddd2fddbec81152e18faccb2710d493 /org.eclipse.jdt.core/model
parent608b50502644f795c100c2571772d0519a266d4a (diff)
downloadorg.eclipse.objectteams-6dcbb38068eee59acb310076b78bc9a8183f88b8.tar.gz
org.eclipse.objectteams-6dcbb38068eee59acb310076b78bc9a8183f88b8.tar.xz
org.eclipse.objectteams-6dcbb38068eee59acb310076b78bc9a8183f88b8.zip
update sources to v_C18, build config to v_C17 (no build containing C18 is available at this point)
Diffstat (limited to 'org.eclipse.jdt.core/model')
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java11
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java7
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java12
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java64
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ByteCodeVisitorAdapter.java15
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java8
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsAttribute.java40
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsEntry.java24
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBytecodeVisitor.java10
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java14
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java71
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java57
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java59
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java13
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java46
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java14
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java7
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java11
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java1
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java13
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java25
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java7
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java1
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/State.java4
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsAttribute.java63
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsEntry.java52
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java16
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java7
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java73
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry2.java66
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java29
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java151
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java16
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties17
35 files changed, 938 insertions, 89 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java
index dbc6e55c7..8d485abb8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,13 @@ public interface IJavaModelMarker {
* @since 2.0
*/
String CLASSPATH_FILE_FORMAT = "classpathFileFormat"; //$NON-NLS-1$
+
+ /**
+ * Output overlapping another source attribute (value <code>"outputOverlappingSource"</code>).
+ * Used only on buildpath problem markers. The value of this attribute is
+ * either "true" or "false".
+ *
+ * @since 3.6.4
+ */
+ String OUTPUT_OVERLAPPING_SOURCE = "outputOverlappingSource"; //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java
index 4cc2f456b..a88db5e10 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java
@@ -345,4 +345,11 @@ public interface IJavaModelStatusConstants {
* @since 3.7
*/
public static final int CANNOT_RETRIEVE_ATTACHED_JAVADOC_TIMEOUT = 1012;
+
+ /**
+ * <p>Status constant indicating that the default or specific output folder is overlapping
+ * with another source location. </p>
+ * @since 3.6.4
+ */
+ public static final int OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE = 1013;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java
index a051e9122..4575100cf 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -618,11 +618,13 @@ public final class JavaConventions {
* <li> The project output location path cannot be null, must be absolute and located inside the project.
* <li> Specific output locations (specified on source entries) can be null, if not they must be located inside the project,
* <li> A project entry cannot refer to itself directly (that is, a project cannot prerequisite itself).
- * <li> Classpath entries or output locations cannot coincidate or be nested in each other, except for the following scenarii listed below:
- * <ul><li> A source folder can coincidate with its own output location, in which case this output can then contain library archives.
- * However, a specific output location cannot coincidate with any library or a distinct source folder than the one referring to it. </li>
+ * <li> Classpath entries or output locations cannot coincide or be nested in each other, except for the following scenarios listed below:
+ * <ul><li> A source folder can coincide with its own output location, in which case this output can then contain library archives.
+ * However, a specific output location cannot coincide with any library or a distinct source folder than the one referring to it.<br>
+ * Note: Since 3.8, this behavior can be overridden by configuring {@link JavaCore#CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE}
+ * </li>
* <li> A source/library folder can be nested in any source folder as long as the nested folder is excluded from the enclosing one. </li>
- * <li> An output location can be nested in a source folder, if the source folder coincidates with the project itself, or if the output
+ * <li> An output location can be nested in a source folder, if the source folder coincides with the project itself, or if the output
* location is excluded from the source folder.
* </ul>
* </ul>
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 fb5424b53..48d526532 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
@@ -84,6 +84,10 @@
* Benjamin Muskalla - added COMPILER_PB_MISSING_SYNCHRONIZED_ON_INHERITED_METHOD
* Stephan Herrmann - added COMPILER_PB_UNUSED_OBJECT_ALLOCATION
* Stephan Herrmann - added COMPILER_PB_SUPPRESS_OPTIONAL_ERRORS
+ * Stephan Herrmann - added the following constants:
+ * COMPILER_PB_UNCLOSED_CLOSEABLE,
+ * COMPILER_PB_POTENTIALLY_UNCLOSED_CLOSEABLE
+ * COMPILER_PB_EXPLICITLY_CLOSED_AUTOCLOSEABLE
*
* Fraunhofer FIRST - extended API and implementation
* Technical University Berlin - extended API and implementation
@@ -1375,6 +1379,52 @@ public final class JavaCore extends Plugin {
*/
public static final String COMPILER_PB_POTENTIALLY_MISSING_STATIC_ON_METHOD = PLUGIN_ID + ".compiler.problem.reportMethodCanBePotentiallyStatic"; //$NON-NLS-1$
/**
+ * Compiler option ID: Reporting a resource that is not closed properly.
+ * <p>When enabled, the compiler will issue an error or a warning if
+ * a local variable holds a value of type <code>java.lang.AutoCloseable</code> (compliance>=1.7)
+ * or a value of type <code>java.io.Closeable</code> (compliance<=1.6) and if
+ * flow analysis shows that the method <code>close()</code> is not invoked locally on that value.
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.reportUnclosedCloseable"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
+ * <dt>Default:</dt><dd><code>"warning"</code></dd>
+ * </dl>
+ * @since 3.8
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_UNCLOSED_CLOSEABLE = PLUGIN_ID + ".compiler.problem.unclosedCloseable"; //$NON-NLS-1$
+ /**
+ * Compiler option ID: Reporting a resource that may not be closed properly.
+ * <p>When enabled, the compiler will issue an error or a warning if
+ * a local variable holds a value of type <code>java.lang.AutoCloseable</code> (compliance>=1.7)
+ * or a value of type <code>java.io.Closeable</code> (compliance<=1.6) and if
+ * flow analysis shows that the method <code>close()</code> is
+ * not invoked locally on that value for all execution paths.
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.reportPotentiallyUnclosedCloseable"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
+ * <dt>Default:</dt><dd><code>"ignore"</code></dd>
+ * </dl>
+ * @since 3.8
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_POTENTIALLY_UNCLOSED_CLOSEABLE = PLUGIN_ID + ".compiler.problem.potentiallyUnclosedCloseable"; //$NON-NLS-1$
+ /**
+ * Compiler option ID: Reporting a resource that is not managed by try-with-resources.
+ * <p>When enabled, the compiler will issue an error or a warning if a local variable
+ * holds a value of type <code>java.lang.AutoCloseable</code>, and if the method
+ * <code>close()</code> is explicitly invoked on that resource, but the resource is
+ * not managed by a try-with-resources block.
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.reportPotentiallyUnclosedCloseable"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
+ * <dt>Default:</dt><dd><code>"ignore"</code></dd>
+ * </dl>
+ * @since 3.8
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_EXPLICITLY_CLOSED_AUTOCLOSEABLE = PLUGIN_ID + ".compiler.problem.explicitlyClosedAutoCloseable"; //$NON-NLS-1$
+ /**
* Compiler option ID: Setting Source Compatibility Mode.
* <p>Specify whether which source level compatibility is used. From 1.4 on, <code>'assert'</code> is a keyword
* reserved for assertion support. Also note, than when toggling to 1.4 mode, the target VM
@@ -1847,6 +1897,19 @@ public final class JavaCore extends Plugin {
*/
public static final String CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS = PLUGIN_ID + ".classpath.multipleOutputLocations"; //$NON-NLS-1$
/**
+ * Core option ID: Reporting an output location overlapping another source location.
+ * <p> Indicate the severity of the problem reported when a source entry's output location overlaps another
+ * source entry. </p>
+ *
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "error", "warning", "ignore" }</code></dd>
+ * <dt>Default:</dt><dd><code>"error"</code></dd>
+ * </dl>
+ * @since 3.6.4
+ */
+ public static final String CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE = PLUGIN_ID + ".classpath.outputOverlappingAnotherSource"; //$NON-NLS-1$
+ /**
* Core option ID: Set the timeout value for retrieving the method's parameter names from javadoc.
* <p>Timeout in milliseconds to retrieve the method's parameter names from javadoc.
* <p>If the value is <code>0</code>, the parameter names are not fetched and the raw names are returned.
@@ -3714,6 +3777,7 @@ public final class JavaCore extends Plugin {
try {
if (JavaBuilder.DEBUG)
System.out.println("Touching " + project.getElementName()); //$NON-NLS-1$
+ new ClasspathValidation((JavaProject) project).validate(); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=287164
project.getProject().touch(progressMonitor2);
} catch (CoreException e) {
// could not touch this project: ignore
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ByteCodeVisitorAdapter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ByteCodeVisitorAdapter.java
index dd894ade6..c23af13ac 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ByteCodeVisitorAdapter.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ByteCodeVisitorAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -923,8 +923,9 @@ public class ByteCodeVisitorAdapter implements IBytecodeVisitor {
// default behavior is to do nothing
}
/**
- * @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
+ * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry, IConstantPoolEntry)
* @since 3.6
+ * @deprecated This has been replaced with {@link IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)}
*/
public void _invokedynamic(
int pc,
@@ -934,6 +935,16 @@ public class ByteCodeVisitorAdapter implements IBytecodeVisitor {
// default behavior is to do nothing
}
/**
+ * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)
+ * @since 3.8
+ */
+ public void _invokedynamic(
+ int pc,
+ int index,
+ IConstantPoolEntry invokeDynamicEntry) {
+ // default behavior is to do nothing
+ }
+ /**
* @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
*/
public void _invokeinterface(
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
index e5dafa407..da838ec9c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,4 +140,10 @@ public interface IAttributeNamesConstants {
* @since 3.2
*/
char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$
+
+ /**
+ * "BootstrapMethods" attribute (added in cldc1.0).
+ * @since 3.8
+ */
+ char[] BOOTSTRAP_METHODS = "BootstrapMethods".toCharArray(); //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsAttribute.java
new file mode 100644
index 000000000..d7bbd91a6
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsAttribute.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of a bootstrap methods attribute as described in the JVM specifications.
+ *
+ * This interface may be implemented by clients.
+ *
+ * @since 3.8
+ */
+public interface IBootstrapMethodsAttribute extends IClassFileAttribute {
+
+ /**
+ * Answer back the number of bootstrap methods of this entry as specified in
+ * the JVM specifications.
+ *
+ * @return the number of bootstrap methods of this entry as specified in
+ * the JVM specifications
+ */
+ int getBootstrapMethodsLength();
+
+ /**
+ * Answer back the bootstrap methods table of this entry as specified in
+ * the JVM specifications. Answer an empty array if none.
+ *
+ * @return the bootstrap methods table of this entry as specified in
+ * the JVM specifications. Answer an empty array if none
+ */
+ IBootstrapMethodsEntry[] getBootstrapMethods();
+
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsEntry.java
new file mode 100644
index 000000000..4078e85f9
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsEntry.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of a bootstrap method table entry as specified in the JVM specifications.
+ *
+ * This interface may be implemented by clients.
+ *
+ * @since 3.8
+ */
+public interface IBootstrapMethodsEntry {
+
+ int getBootstrapMethodReference();
+ int[] getBootstrapArguments();
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBytecodeVisitor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBytecodeVisitor.java
index 52ccb168f..f36db8c38 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBytecodeVisitor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBytecodeVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -168,12 +168,20 @@ public interface IBytecodeVisitor {
IConstantPoolEntry constantClass);
/**
* @since 3.6
+ * @deprecated This has been replaced with {@link #_invokedynamic(int, int, IConstantPoolEntry)}
*/
void _invokedynamic(
int pc,
int index,
IConstantPoolEntry nameEntry,
IConstantPoolEntry descriptorEntry);
+ /**
+ * @since 3.8
+ */
+ void _invokedynamic(
+ int pc,
+ int index,
+ IConstantPoolEntry invokeDynamic);
void _invokeinterface(
int pc,
int index,
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java
index 69526063b..9f57bb10f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,8 +27,7 @@ public interface IConstantPool {
int getConstantPoolCount();
/**
- * Answer back the type of the entry at the index @index
- * in the constant pool.
+ * Answer back the type of the entry at the given index in the constant pool.
*
* @param index the index of the entry in the constant pool
* @return the type of the entry at the index @index in the constant pool
@@ -36,11 +35,14 @@ public interface IConstantPool {
int getEntryKind(int index);
/**
- * Answer back the entry at the index @index
- * in the constant pool.
+ * Answer back the entry at the given index in the constant pool.
+ *
+ * <p>The return value can be an instance of {@link IConstantPoolEntry2} if the value returned
+ * by {@link #getEntryKind(int)} is either {@link IConstantPoolConstant#CONSTANT_MethodHandle},
+ * {@link IConstantPoolConstant#CONSTANT_MethodType} or {@link IConstantPoolConstant#CONSTANT_InvokeDynamic}.</p>
*
* @param index the index of the entry in the constant pool
- * @return the entry at the index @index in the constant pool
+ * @return the entry at the given index in the constant pool
*/
IConstantPoolEntry decodeEntry(int index);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java
index bc7cb54fb..ff6ed22c2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,18 @@ public interface IConstantPoolConstant {
int CONSTANT_Double = 6;
int CONSTANT_NameAndType = 12;
int CONSTANT_Utf8 = 1;
+ /**
+ * @since 3.8
+ */
+ int CONSTANT_MethodHandle = 15;
+ /**
+ * @since 3.8
+ */
+ int CONSTANT_MethodType = 16;
+ /**
+ * @since 3.8
+ */
+ int CONSTANT_InvokeDynamic = 18;
int CONSTANT_Methodref_SIZE = 5;
int CONSTANT_Class_SIZE = 3;
@@ -41,5 +53,62 @@ public interface IConstantPoolConstant {
int CONSTANT_String_SIZE = 3;
int CONSTANT_Utf8_SIZE = 3;
int CONSTANT_NameAndType_SIZE = 5;
+ /**
+ * @since 3.8
+ */
+ int CONSTANT_MethodHandle_SIZE = 4;
+ /**
+ * @since 3.8
+ */
+ int CONSTANT_MethodType_SIZE = 3;
+ /**
+ * @since 3.8
+ */
+ int CONSTANT_InvokeDynamic_SIZE = 5;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_GetField = 1;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_GetStatic = 2;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_PutField = 3;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_PutStatic = 4;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_InvokeVirtual = 5;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_InvokeStatic = 6;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_InvokeSpecial = 7;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_NewInvokeSpecial = 8;
+ /**
+ * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
+ * @since 3.8
+ */
+ int METHOD_TYPE_REF_InvokeInterface = 9;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java
index 487ad82e4..c75bd40be 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,6 +32,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the name index for a CONSTANT_Class type entry
+ * @see IConstantPoolConstant#CONSTANT_Class
*/
int getClassInfoNameIndex();
@@ -42,16 +43,25 @@ public interface IConstantPoolEntry {
*
* @return the class index for a CONSTANT_Fieldref,
* CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
+ * @see IConstantPoolConstant#CONSTANT_Fieldref
+ * @see IConstantPoolConstant#CONSTANT_Methodref
+ * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
*/
int getClassIndex();
/**
* Returns the nameAndType index for a CONSTANT_Fieldref,
- * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry.
+ * CONSTANT_Methodref, CONSTANT_InterfaceMethodref,
+ * CONSTANT_InvokeDynamic type entry.
* The value is unspecified otherwise.
*
* @return the nameAndType index for a CONSTANT_Fieldref,
- * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
+ * CONSTANT_Methodref, CONSTANT_InterfaceMethodref,
+ * CONSTANT_InvokeDynamic type entry
+ * @see IConstantPoolConstant#CONSTANT_Fieldref
+ * @see IConstantPoolConstant#CONSTANT_Methodref
+ * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
+ * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
*/
int getNameAndTypeIndex();
@@ -60,6 +70,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the string index for a CONSTANT_String type entry
+ * @see IConstantPoolConstant#CONSTANT_String
*/
int getStringIndex();
@@ -68,6 +79,7 @@ public interface IConstantPoolEntry {
* Returns null otherwise.
*
* @return the string value for a CONSTANT_String type entry
+ * @see IConstantPoolConstant#CONSTANT_String
*/
String getStringValue();
@@ -76,6 +88,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the integer value for a CONSTANT_Integer type entry
+ * @see IConstantPoolConstant#CONSTANT_Integer
*/
int getIntegerValue();
@@ -84,6 +97,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the float value for a CONSTANT_Float type entry
+ * @see IConstantPoolConstant#CONSTANT_Float
*/
float getFloatValue();
@@ -92,6 +106,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the double value for a CONSTANT_Double type entry
+ * @see IConstantPoolConstant#CONSTANT_Double
*/
double getDoubleValue();
@@ -100,6 +115,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the long value for a CONSTANT_Long type entry
+ * @see IConstantPoolConstant#CONSTANT_Long
*/
long getLongValue();
@@ -108,6 +124,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the descriptor index for a CONSTANT_NameAndType type entry
+ * @see IConstantPoolConstant#CONSTANT_NameAndType
*/
int getNameAndTypeInfoDescriptorIndex();
@@ -116,6 +133,7 @@ public interface IConstantPoolEntry {
* The value is unspecified otherwise.
*
* @return the name index for a CONSTANT_NameAndType type entry
+ * @see IConstantPoolConstant#CONSTANT_NameAndType
*/
int getNameAndTypeInfoNameIndex();
@@ -124,6 +142,7 @@ public interface IConstantPoolEntry {
* Returns null otherwise.
*
* @return the class name for a CONSTANT_Class type entry
+ * @see IConstantPoolConstant#CONSTANT_Class
*/
char[] getClassInfoName();
@@ -134,6 +153,9 @@ public interface IConstantPoolEntry {
*
* @return the class name for a CONSTANT_Fieldref,
* CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
+ * @see IConstantPoolConstant#CONSTANT_Fieldref
+ * @see IConstantPoolConstant#CONSTANT_Methodref
+ * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
*/
char[] getClassName();
@@ -142,16 +164,20 @@ public interface IConstantPoolEntry {
* Returns null otherwise.
*
* @return the field name for a CONSTANT_Fieldref type entry
+ * @see IConstantPoolConstant#CONSTANT_Fieldref
*/
char[] getFieldName();
/**
- * Returns the field name for a CONSTANT_Methodref or CONSTANT_InterfaceMethodred
- * type entry.
+ * Returns the field name for a CONSTANT_Methodref, CONSTANT_InterfaceMethodref
+ * or CONSTANT_InvokeDynamic type entry.
* Returns null otherwise.
*
- * @return the field name for a CONSTANT_Methodref or CONSTANT_InterfaceMethodred
- * type entry
+ * @return the method name for a CONSTANT_Methodref, CONSTANT_InterfaceMethodref
+ * or CONSTANT_InvokeDynamic type entry
+ * @see IConstantPoolConstant#CONSTANT_Methodref
+ * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
+ * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
*/
char[] getMethodName();
@@ -162,18 +188,27 @@ public interface IConstantPoolEntry {
*
* @return the field descriptor value for a CONSTANT_Fieldref type entry. This value
* is set only when decoding the CONSTANT_Fieldref entry
+ * @see IConstantPoolConstant#CONSTANT_Fieldref
*/
char[] getFieldDescriptor();
/**
* Returns the method descriptor value for a CONSTANT_Methodref or
* CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
- * CONSTANT_Methodref or CONSTANT_InterfaceMethodref entry.
+ * CONSTANT_Methodref, CONSTANT_InterfaceMethodref, CONSTANT_MethodType
+ * or CONSTANT_InvokeDynamic entry.
+ *
* Returns null otherwise.
*
- * @return the method descriptor value for a CONSTANT_Methodref or
+ * @return the method descriptor value for a CONSTANT_Methodref,
* CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
- * CONSTANT_Methodref or CONSTANT_InterfaceMethodref entry
+ * CONSTANT_Methodref, CONSTANT_InterfaceMethodref, CONSTANT_MethodType
+ * or CONSTANT_InvokeDynamic entry
+ *
+ * @see IConstantPoolConstant#CONSTANT_Methodref
+ * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
+ * @see IConstantPoolConstant#CONSTANT_MethodType
+ * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
*/
char[] getMethodDescriptor();
@@ -184,6 +219,7 @@ public interface IConstantPoolEntry {
*
* @return the utf8 value for a CONSTANT_Utf8 type entry. This value is set only when
* decoding a UTF8 entry
+ * @see IConstantPoolConstant#CONSTANT_Utf8
*/
char[] getUtf8Value();
@@ -194,6 +230,7 @@ public interface IConstantPoolEntry {
*
* @return the utf8 length for a CONSTANT_Utf8 type entry. This value is set only when
* decoding a UTF8 entry
+ * @see IConstantPoolConstant#CONSTANT_Utf8
*/
int getUtf8Length();
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java
new file mode 100644
index 000000000..3b4984bcd
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.util;
+
+/**
+ * Description of the new constant pool entry as described in the JVM specifications
+ * added for Java 7 support.
+ * Its contents is initialized according to its kind.
+ *
+ * This interface may be implemented by clients.
+ *
+ * @since 3.8
+ */
+public interface IConstantPoolEntry2 extends IConstantPoolEntry {
+ /**
+ * Returns the descriptor index. This value is set only when decoding a MethodType entry.
+ * The value is unspecified otherwise. The corresponding UTF8 value can be retrieved by using
+ * {@link #getMethodDescriptor()}.
+ *
+ * @return the descriptor index. This value is set only when decoding a MethodType entry.
+ * @see IConstantPoolConstant#CONSTANT_MethodType
+ */
+ int getDescriptorIndex();
+
+ /**
+ * Returns the reference kind. This value is set only when decoding a MethodHandle entry.
+ * The value is unspecified otherwise.
+ *
+ * @return the reference kind. This value is set only when decoding a MethodHandle entry.
+ * @see IConstantPoolConstant#CONSTANT_MethodHandle
+ */
+ int getReferenceKind();
+
+ /**
+ * Returns the reference index. This value is set only when decoding a MethodHandle entry.
+ * The value is unspecified otherwise.
+ *
+ * @return the reference kind. This value is set only when decoding a MethodHandle entry.
+ * @see IConstantPoolConstant#CONSTANT_MethodHandle
+ */
+ int getReferenceIndex();
+
+ /**
+ * Returns the bootstrap method attribute index. This value is set only when decoding a InvokeDynamic entry.
+ * The value is unspecified otherwise.
+ *
+ * @return the reference kind. This value is set only when decoding a MethodHandle entry.
+ * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
+ */
+ int getBootstrapMethodAttributeIndex();
+}
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 fbd0b539b..d1bbbb38a 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, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,7 +8,9 @@
*
* 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
+ * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
+ * Bug 320841 - TypeConverters don't set enclosingType
+ * Bug 353474 - type converters should include more annotations
* Fraunhofer FIRST - extended API and implementation
* Technical University Berlin - extended API and implementation
*******************************************************************************/
@@ -32,6 +34,7 @@ import org.eclipse.jdt.core.IAnnotatable;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IImportDeclaration;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
@@ -405,6 +408,7 @@ public class SourceTypeConverter extends TypeConverter {
char[][] argumentNames = methodInfo.getArgumentNames();
int argumentCount = argumentTypeSignatures == null ? 0 : argumentTypeSignatures.length;
if (argumentCount > 0) {
+ ILocalVariable[] parameters = methodHandle.getParameters();
long position = ((long) start << 32) + end;
method.arguments = new Argument[argumentCount];
for (int i = 0; i < argumentCount; i++) {
@@ -426,6 +430,11 @@ public class SourceTypeConverter extends TypeConverter {
typeReference,
ClassFileConstants.AccDefault);
// do not care whether was final or not
+ // convert 1.5 specific constructs only if compliance is 1.5 or above
+ if (this.has1_5Compliance) {
+ /* convert annotations */
+ method.arguments[i].annotations = convertAnnotations(parameters[i]);
+ }
}
}
//{ObjectTeams: enhance signature for callin method:
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
index d8086ffc9..5656323e4 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Terry Parker <tparker@google.com> - DeltaProcessor misses state changes in archive files, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=357425
*******************************************************************************/
package org.eclipse.jdt.internal.core;
@@ -1776,6 +1777,7 @@ public class ClasspathEntry implements IClasspathEntry {
// perform one separate iteration so as to not take precedence over previously checked scenarii (in particular should
// diagnose nesting source folder issue before this one, for example, [src]"Project/", [src]"Project/source/" and output="Project/" should
// first complain about missing exclusion pattern
+ IJavaModelStatus cachedStatus = null;
for (int i = 0 ; i < length; i++) {
IClasspathEntry entry = classpath[i];
if (entry == null) continue;
@@ -1788,30 +1790,53 @@ public class ClasspathEntry implements IClasspathEntry {
if (kind == IClasspathEntry.CPE_SOURCE) {
IPath output = entry.getOutputLocation();
- if (output == null) continue; // 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate)
- // if (output == null) output = projectOutputLocation; // if no specific output, still need to check using default output (this line would check default output)
+ if (output == null) output = projectOutputLocation; // if no specific output, still need to check using default output (this line would check default output)
for (int j = 0; j < length; j++) {
IClasspathEntry otherEntry = classpath[j];
if (otherEntry == entry) continue;
- // Build some common strings for status message
- boolean opStartsWithProject = projectName.equals(otherEntry.getPath().segment(0));
- String otherPathMsg = opStartsWithProject ? otherEntry.getPath().removeFirstSegments(1).toString() : otherEntry.getPath().makeRelative().toString();
-
switch (otherEntry.getEntryKind()) {
case IClasspathEntry.CPE_SOURCE :
- if (otherEntry.getPath().equals(output)) {
- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotUseDistinctSourceFolderAsOutput, new String[] {entryPathMsg, otherPathMsg, projectName}));
+ // Bug 287164 : Report errors of overlapping output locations only if the user sets the corresponding preference.
+ // The check is required for backward compatibility with bug-fix 36465.
+ String option = javaProject.getOption(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE, true);
+ if (otherEntry.getPath().equals(output)
+ && !JavaCore.IGNORE.equals(option)) {
+ boolean opStartsWithProject = projectName.equals(otherEntry.getPath().segment(0));
+ String otherPathMsg = opStartsWithProject ? otherEntry.getPath().removeFirstSegments(1).toString() : otherEntry.getPath().makeRelative().toString();
+ if (JavaCore.ERROR.equals(option)) {
+ return new JavaModelStatus(IStatus.ERROR, IJavaModelStatusConstants.OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE,
+ Messages.bind(Messages.classpath_cannotUseDistinctSourceFolderAsOutput, new String[] {
+ entryPathMsg, otherPathMsg, projectName }));
+ }
+ if (cachedStatus == null) {
+ // Note that the isOK() is being overridden to return true. This is an exceptional scenario
+ cachedStatus = new JavaModelStatus(IStatus.OK, IJavaModelStatusConstants.OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE,
+ Messages.bind(Messages.classpath_cannotUseDistinctSourceFolderAsOutput, new String[] {
+ entryPathMsg, otherPathMsg, projectName })){
+ public boolean isOK() {
+ return true;
+ }
+ };
+ }
}
break;
case IClasspathEntry.CPE_LIBRARY :
- if (otherEntry.getPath().equals(output)) {
+ if (output != projectOutputLocation && otherEntry.getPath().equals(output)) {
+ boolean opStartsWithProject = projectName.equals(otherEntry.getPath().segment(0));
+ String otherPathMsg = opStartsWithProject ? otherEntry.getPath().removeFirstSegments(1).toString() : otherEntry.getPath().makeRelative().toString();
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotUseLibraryAsOutput, new String[] {entryPathMsg, otherPathMsg, projectName}));
}
}
}
}
}
+
+ // NOTE: The above code that checks for IJavaModelStatusConstants.OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE, can be configured to return
+ // a WARNING status and hence should be at the end of this validation method. Any other code that might return a more severe ERROR should be
+ // inserted before the mentioned code.
+ if (cachedStatus != null) return cachedStatus;
+
return JavaModelStatus.VERIFIED_OK;
}
@@ -1827,6 +1852,9 @@ public class ClasspathEntry implements IClasspathEntry {
* @return a java model status describing the problem related to this classpath entry if any, a status object with code <code>IStatus.OK</code> if the entry is fine
*/
public static IJavaModelStatus validateClasspathEntry(IJavaProject project, IClasspathEntry entry, boolean checkSourceAttachment, boolean referredByContainer){
+ if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ JavaModelManager.getJavaModelManager().removeFromInvalidArchiveCache(entry.getPath());
+ }
IJavaModelStatus status = validateClasspathEntry(project, entry, null, checkSourceAttachment, referredByContainer);
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=171136 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=300136
// Ignore class path errors from optional entries.
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java
index ea310a3c2..345535ac1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -12,6 +12,7 @@ package org.eclipse.jdt.internal.core;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaModelStatus;
import org.eclipse.jdt.core.JavaModelException;
@@ -37,7 +38,7 @@ public class ClasspathValidation {
// project doesn't exist
IProject resource = this.project.getProject();
if (resource.isAccessible()) {
- this.project.flushClasspathProblemMarkers(true/*flush cycle markers*/, true/*flush classpath format markers*/);
+ this.project.flushClasspathProblemMarkers(true/*flush cycle markers*/, true/*flush classpath format markers*/, true /*flush overlapping output markers*/);
// remove problems and tasks created by the builder
JavaBuilder.removeProblemsAndTasksFor(resource);
@@ -56,12 +57,15 @@ public class ClasspathValidation {
}
// update classpath format problems
- this.project.flushClasspathProblemMarkers(false/*cycle*/, true/*format*/);
+ this.project.flushClasspathProblemMarkers(false/*cycle*/, true/*format*/, false/*overlapping*/);
if (!status.isOK())
this.project.createClasspathProblemMarker(status);
+ // update overlapping output problem markers
+ this.project.flushClasspathProblemMarkers(false/*cycle*/, false/*format*/, true/*overlapping*/);
+
// update resolved classpath problems
- this.project.flushClasspathProblemMarkers(false/*cycle*/, false/*format*/);
+ this.project.flushClasspathProblemMarkers(false/*cycle*/, false/*format*/, false/*overlapping*/);
if (rawClasspath != JavaProject.INVALID_CLASSPATH && outputLocation != null) {
for (int i = 0; i < rawClasspath.length; i++) {
@@ -71,7 +75,7 @@ public class ClasspathValidation {
}
}
status = ClasspathEntry.validateClasspath(this.project, rawClasspath, outputLocation);
- if (!status.isOK())
+ if (status.getCode() != IStatus.OK)
this.project.createClasspathProblemMarker(status);
}
}
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 f2b617350..4a1d8ba87 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -100,8 +100,9 @@ public class CompilationUnitProblemFinder extends Compiler {
*/
public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, AccessRestriction accessRestriction) {
// ensure to jump back to toplevel type for first one (could be a member)
-// while (sourceTypes[0].getEnclosingType() != null)
-// sourceTypes[0] = sourceTypes[0].getEnclosingType();
+ while (sourceTypes[0].getEnclosingType() != null) {
+ sourceTypes[0] = sourceTypes[0].getEnclosingType();
+ }
CompilationResult result =
new CompilationResult(sourceTypes[0].getFileName(), 1, 1, this.options.maxProblemsPerUnit);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
index f7a0c1cb8..126fcc918 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
@@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Terry Parker <tparker@google.com> - DeltaProcessor exhibits O(N^2) behavior, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=354332
+ * Terry Parker <tparker@google.com> - DeltaProcessor misses state changes in archive files, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=357425
*******************************************************************************/
package org.eclipse.jdt.internal.core;
@@ -954,7 +955,7 @@ public class DeltaProcessor {
// project does not exist -> ignore
continue;
}
- boolean hasChainedJar = false;
+ boolean deltaContainsModifiedJar = false;
for (int j = 0; j < entries.length; j++){
if (entries[j].getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
IPath entryPath = entries[j].getPath();
@@ -1024,7 +1025,7 @@ public class DeltaProcessor {
System.out.println("- External JAR ADDED, affecting root: "+root.getElementName()); //$NON-NLS-1$
}
elementAdded(root, null, null);
- hasChainedJar |= !this.manager.isNonChainingJar(entryPath);
+ deltaContainsModifiedJar = true;
this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733
hasDelta = true;
} else if (status == EXTERNAL_JAR_CHANGED) {
@@ -1033,7 +1034,7 @@ public class DeltaProcessor {
System.out.println("- External JAR CHANGED, affecting root: "+root.getElementName()); //$NON-NLS-1$
}
contentChanged(root);
- hasChainedJar |= !this.manager.isNonChainingJar(entryPath);
+ deltaContainsModifiedJar = true;
hasDelta = true;
} else if (status == EXTERNAL_JAR_REMOVED) {
PackageFragmentRoot root = (PackageFragmentRoot) javaProject.getPackageFragmentRoot(entryPath.toString());
@@ -1041,7 +1042,7 @@ public class DeltaProcessor {
System.out.println("- External JAR REMOVED, affecting root: "+root.getElementName()); //$NON-NLS-1$
}
elementRemoved(root, null, null);
- hasChainedJar |= !this.manager.isNonChainingJar(entryPath);
+ deltaContainsModifiedJar = true;
this.state.addClasspathValidation(javaProject); // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=185733
hasDelta = true;
}
@@ -1049,7 +1050,7 @@ public class DeltaProcessor {
}
}
- if (hasChainedJar) {
+ if (deltaContainsModifiedJar) {
javaProject.resetResolvedClasspath();
}
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java
index 532ed94d7..91c6ddeca 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java
@@ -58,6 +58,7 @@ public class JavaCorePreferenceInitializer extends AbstractPreferenceInitializer
defaultOptionsMap.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.IGNORE);
defaultOptionsMap.put(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, JavaCore.ENABLED);
defaultOptionsMap.put(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, JavaCore.ENABLED);
+ defaultOptionsMap.put(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE, JavaCore.ERROR);
// encoding setting comes from resource plug-in
optionNames.add(JavaCore.CORE_ENCODING);
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 4127a2236..d9048ce78 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
@@ -11,6 +11,7 @@
* before its contents
* (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=102422)
* Stephan Herrmann - Contribution for Bug 346010 - [model] strange initialization dependency in OptionTests
+ * Terry Parker <tparker@google.com> - DeltaProcessor misses state changes in archive files, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=357425
* Technical University Berlin - extended API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.core;
@@ -1487,7 +1488,8 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
propertyName.equals(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS) ||
propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) ||
- propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL)) {
+ propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL) ||
+ propertyName.equals(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE)) {
JavaModelManager manager = JavaModelManager.getJavaModelManager();
IJavaModel model = manager.getJavaModel();
IJavaProject[] projects;
@@ -2254,7 +2256,8 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
defaultOptionsMap.put(JavaCore.CORE_JAVA_BUILD_ORDER, JavaCore.IGNORE);
defaultOptionsMap.put(JavaCore.CORE_INCOMPLETE_CLASSPATH, JavaCore.ERROR);
defaultOptionsMap.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.ERROR);
- defaultOptionsMap.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.IGNORE);
+ defaultOptionsMap.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.IGNORE);
+ defaultOptionsMap.put(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE, JavaCore.ERROR);
defaultOptionsMap.put(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, JavaCore.ENABLED);
defaultOptionsMap.put(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS, JavaCore.ENABLED);
@@ -3092,6 +3095,12 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
return this.invalidArchives != null && this.invalidArchives.contains(path);
}
+ public void removeFromInvalidArchiveCache(IPath path) {
+ if (this.invalidArchives != null) {
+ this.invalidArchives.remove(path);
+ }
+ }
+
public void setClasspathBeingResolved(IJavaProject project, boolean classpathIsResolved) {
if (classpathIsResolved) {
getClasspathBeingResolved().add(project);
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 5de8f6480..5fd9dce56 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
@@ -437,7 +437,7 @@ public class JavaProject
new JavaModelStatus(IJavaModelStatusConstants.CLASSPATH_CYCLE, project, cycleString));
}
} else {
- project.flushClasspathProblemMarkers(true, false);
+ project.flushClasspathProblemMarkers(true, false, false);
}
}
}
@@ -807,7 +807,7 @@ public class JavaProject
IMarker marker = null;
int severity;
String[] arguments = CharOperation.NO_STRINGS;
- boolean isCycleProblem = false, isClasspathFileFormatProblem = false;
+ boolean isCycleProblem = false, isClasspathFileFormatProblem = false, isOutputOverlapping = false;
switch (status.getCode()) {
case IJavaModelStatusConstants.CLASSPATH_CYCLE :
@@ -834,7 +834,17 @@ public class JavaProject
return; // setting == IGNORE
}
break;
-
+ case IJavaModelStatusConstants.OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE :
+ isOutputOverlapping = true;
+ setting = getOption(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE, true);
+ if (JavaCore.ERROR.equals(setting)) {
+ severity = IMarker.SEVERITY_ERROR;
+ } else if (JavaCore.WARNING.equals(setting)) {
+ severity = IMarker.SEVERITY_WARNING;
+ } else {
+ return; // setting == IGNORE
+ }
+ break;
default:
IPath path = status.getPath();
if (path != null) arguments = new String[] { path.toString() };
@@ -856,6 +866,7 @@ public class JavaProject
IMarker.LOCATION,
IJavaModelMarker.CYCLE_DETECTED,
IJavaModelMarker.CLASSPATH_FILE_FORMAT,
+ IJavaModelMarker.OUTPUT_OVERLAPPING_SOURCE,
IJavaModelMarker.ID,
IJavaModelMarker.ARGUMENTS ,
IJavaModelMarker.CATEGORY_ID,
@@ -867,6 +878,7 @@ public class JavaProject
Messages.classpath_buildPath,
isCycleProblem ? "true" : "false",//$NON-NLS-1$ //$NON-NLS-2$
isClasspathFileFormatProblem ? "true" : "false",//$NON-NLS-1$ //$NON-NLS-2$
+ isOutputOverlapping ? "true" : "false", //$NON-NLS-1$ //$NON-NLS-2$
new Integer(status.getCode()),
Util.getProblemArgumentsForMarker(arguments) ,
new Integer(CategorizedProblem.CAT_BUILDPATH),
@@ -1387,18 +1399,20 @@ public class JavaProject
/**
* Remove all markers denoting classpath problems
*/ //TODO (philippe) should improve to use a bitmask instead of booleans (CYCLE, FORMAT, VALID)
- protected void flushClasspathProblemMarkers(boolean flushCycleMarkers, boolean flushClasspathFormatMarkers) {
+ protected void flushClasspathProblemMarkers(boolean flushCycleMarkers, boolean flushClasspathFormatMarkers, boolean flushOverlappingOutputMarkers) {
try {
if (this.project.isAccessible()) {
IMarker[] markers = this.project.findMarkers(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
for (int i = 0, length = markers.length; i < length; i++) {
IMarker marker = markers[i];
- if (flushCycleMarkers && flushClasspathFormatMarkers) {
+ if (flushCycleMarkers && flushClasspathFormatMarkers && flushOverlappingOutputMarkers) {
marker.delete();
} else {
String cycleAttr = (String)marker.getAttribute(IJavaModelMarker.CYCLE_DETECTED);
String classpathFileFormatAttr = (String)marker.getAttribute(IJavaModelMarker.CLASSPATH_FILE_FORMAT);
+ String overlappingOutputAttr = (String) marker.getAttribute(IJavaModelMarker.OUTPUT_OVERLAPPING_SOURCE);
if ((flushCycleMarkers == (cycleAttr != null && cycleAttr.equals("true"))) //$NON-NLS-1$
+ && (flushOverlappingOutputMarkers == (overlappingOutputAttr != null && overlappingOutputAttr.equals("true"))) //$NON-NLS-1$
&& (flushClasspathFormatMarkers == (classpathFileFormatAttr != null && classpathFileFormatAttr.equals("true")))){ //$NON-NLS-1$
marker.delete();
}
@@ -1545,6 +1559,7 @@ public class JavaProject
propertyName.equals(JavaCore.CORE_ENABLE_CLASSPATH_MULTIPLE_OUTPUT_LOCATIONS) ||
propertyName.equals(JavaCore.CORE_INCOMPLETE_CLASSPATH) ||
propertyName.equals(JavaCore.CORE_CIRCULAR_CLASSPATH) ||
+ propertyName.equals(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE) ||
propertyName.equals(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL))
{
manager.deltaState.addClasspathValidation(JavaProject.this);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
index 59c69cec5..d08dff54f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java
@@ -987,6 +987,13 @@ public class NameLookup implements SuffixConstants {
break;
case IPackageFragmentRoot.K_SOURCE :
seekTypesInSourcePackage(matchName, pkg, firstDot, partialMatch, topLevelTypeName, acceptFlags, requestor);
+ if (matchName.indexOf('$') != -1) {
+ matchName= matchName.replace('$', '.');
+ firstDot = matchName.indexOf('.');
+ if (!partialMatch)
+ topLevelTypeName = firstDot == -1 ? matchName : matchName.substring(0, firstDot);
+ seekTypesInSourcePackage(matchName, pkg, firstDot, partialMatch, topLevelTypeName, acceptFlags, requestor);
+ }
break;
default :
return;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java
index 96238136d..ec0ccf277 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java
@@ -114,6 +114,7 @@ public class SetClasspathOperation extends ChangeClasspathOperation {
IJavaModelStatus status = super.verify();
if (!status.isOK())
return status;
+ this.project.flushClasspathProblemMarkers(false, false, true);
return ClasspathEntry.validateClasspath( this.project, this.newRawClasspath, this.newOutputLocation);
}
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 3b170b51b..fda0e8fa1 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -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 = 0x0019; // fix for 325755
+public static final byte VERSION = 0x001A; // fix for 287164
static final byte SOURCE_FOLDER = 1;
static final byte BINARY_FOLDER = 2;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsAttribute.java
new file mode 100644
index 000000000..b196927ea
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsAttribute.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IBootstrapMethodsAttribute;
+import org.eclipse.jdt.core.util.IBootstrapMethodsEntry;
+import org.eclipse.jdt.core.util.IConstantPool;
+
+/**
+ * Default implementation of IBootstrapMethodsAttribute.
+ */
+public class BootstrapMethodsAttribute extends ClassFileAttribute implements IBootstrapMethodsAttribute {
+ private static final IBootstrapMethodsEntry[] NO_ENTRIES = new IBootstrapMethodsEntry[0];
+
+ private IBootstrapMethodsEntry[] entries;
+ private int numberOfBootstrapMethods;
+
+ /**
+ * Constructor for BootstrapMethodsAttribute.
+ * @param classFileBytes
+ * @param constantPool
+ * @param offset
+ * @throws ClassFormatException
+ */
+ public BootstrapMethodsAttribute(
+ byte[] classFileBytes,
+ IConstantPool constantPool,
+ int offset) throws ClassFormatException {
+ super(classFileBytes, constantPool, offset);
+ this.numberOfBootstrapMethods = u2At(classFileBytes, 6, offset);
+ final int length = this.numberOfBootstrapMethods;
+ if (length != 0) {
+ int readOffset = 8;
+ this.entries = new IBootstrapMethodsEntry[length];
+ for (int i = 0; i < length; i++) {
+ this.entries[i] = new BootstrapMethodsEntry(classFileBytes, constantPool, offset + readOffset);
+ readOffset += 8;
+ }
+ } else {
+ this.entries = NO_ENTRIES;
+ }
+ }
+
+ /**
+ * @see IBootstrapMethodsAttribute#getBootstrapMethods()
+ */
+ public IBootstrapMethodsEntry[] getBootstrapMethods() {
+ return this.entries;
+ }
+
+ public int getBootstrapMethodsLength() {
+ return this.numberOfBootstrapMethods;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsEntry.java
new file mode 100644
index 000000000..e444dbd81
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsEntry.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.core.util;
+
+import org.eclipse.jdt.core.util.ClassFormatException;
+import org.eclipse.jdt.core.util.IBootstrapMethodsEntry;
+import org.eclipse.jdt.core.util.IConstantPool;
+
+/**
+ * Default implementation of {@link IBootstrapMethodsEntry}
+ */
+public class BootstrapMethodsEntry
+ extends ClassFileStruct
+ implements IBootstrapMethodsEntry {
+
+ private int bootstrapMethodReference;
+ private int[] bootstrapArguments;
+
+ public BootstrapMethodsEntry(byte classFileBytes[], IConstantPool constantPool, int offset) throws ClassFormatException {
+ this.bootstrapMethodReference = u2At(classFileBytes, 0, offset);
+ int length = u2At(classFileBytes, 2, offset);
+ int[] arguments = new int[length];
+ int position = 4;
+ for (int i = 0; i < length; i++) {
+ arguments[i] = u2At(classFileBytes, position, offset);
+ position += 2;
+ }
+ this.bootstrapArguments = arguments;
+ }
+
+ /**
+ * @see IBootstrapMethodsEntry#getBootstrapArguments()
+ */
+ public int[] getBootstrapArguments() {
+ return this.bootstrapArguments;
+ }
+
+ /**
+ * @see IBootstrapMethodsEntry#getBootstrapMethodReference()
+ */
+ public int getBootstrapMethodReference() {
+ return this.bootstrapMethodReference;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
index 19b80dcc3..0426dc431 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,6 +140,18 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
constantPoolOffsets[i] = readOffset;
readOffset += IConstantPoolConstant.CONSTANT_NameAndType_SIZE;
break;
+ case IConstantPoolConstant.CONSTANT_MethodHandle :
+ constantPoolOffsets[i] = readOffset;
+ readOffset += IConstantPoolConstant.CONSTANT_MethodHandle_SIZE;
+ break;
+ case IConstantPoolConstant.CONSTANT_MethodType :
+ constantPoolOffsets[i] = readOffset;
+ readOffset += IConstantPoolConstant.CONSTANT_MethodType_SIZE;
+ break;
+ case IConstantPoolConstant.CONSTANT_InvokeDynamic :
+ constantPoolOffsets[i] = readOffset;
+ readOffset += IConstantPoolConstant.CONSTANT_InvokeDynamic_SIZE;
+ break;
default:
throw new ClassFormatException(ClassFormatException.INVALID_TAG_CONSTANT);
}
@@ -261,6 +273,8 @@ public class ClassFileReader extends ClassFileStruct implements IClassFileReader
this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
+ } else if (equals(attributeName, IAttributeNamesConstants.BOOTSTRAP_METHODS)) {
+ this.attributes[attributesIndex++] = new BootstrapMethodsAttribute(classFileBytes, this.constantPool, readOffset);
} else {
this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
index 82ba955ae..a281ab0df 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -1049,14 +1049,13 @@ public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute
case IOpcodeMnemonics.INVOKEDYNAMIC :
index = u2At(this.classFileBytes, 1, pc);
constantPoolEntry = this.constantPool.decodeEntry(index);
- if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_NameAndType) {
+ if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_InvokeDynamic) {
throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
}
visitor._invokedynamic(
pc - this.codeOffset,
index,
- this.constantPool.decodeEntry(constantPoolEntry.getNameAndTypeInfoNameIndex()),
- this.constantPool.decodeEntry(constantPoolEntry.getNameAndTypeInfoDescriptorIndex()));
+ constantPoolEntry);
pc += 5;
break;
case IOpcodeMnemonics.NEW :
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java
index aeeee24fc..a9c4699b2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,19 +33,28 @@ public class ConstantPool extends ClassFileStruct implements IConstantPool {
* @see IConstantPool#decodeEntry(int)
*/
public IConstantPoolEntry decodeEntry(int index) {
- ConstantPoolEntry constantPoolEntry = new ConstantPoolEntry();
- constantPoolEntry.reset();
+ ConstantPoolEntry constantPoolEntry = null;
int kind = getEntryKind(index);
- constantPoolEntry.setKind(kind);
switch(kind) {
case IConstantPoolConstant.CONSTANT_Class :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setClassInfoNameIndex(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
constantPoolEntry.setClassInfoName(getUtf8ValueAt(constantPoolEntry.getClassInfoNameIndex()));
break;
case IConstantPoolConstant.CONSTANT_Double :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setDoubleValue(doubleAt(this.classFileBytes, 1, this.constantPoolOffset[index]));
break;
case IConstantPoolConstant.CONSTANT_Fieldref :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setClassIndex(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
int declaringClassIndex = u2At(this.classFileBytes, 1, this.constantPoolOffset[constantPoolEntry.getClassIndex()]);
constantPoolEntry.setClassName(getUtf8ValueAt(declaringClassIndex));
@@ -57,6 +66,11 @@ public class ConstantPool extends ClassFileStruct implements IConstantPool {
break;
case IConstantPoolConstant.CONSTANT_Methodref :
case IConstantPoolConstant.CONSTANT_InterfaceMethodref :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setClassIndex(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
declaringClassIndex = u2At(this.classFileBytes, 1, this.constantPoolOffset[constantPoolEntry.getClassIndex()]);
constantPoolEntry.setClassName(getUtf8ValueAt(declaringClassIndex));
@@ -67,25 +81,76 @@ public class ConstantPool extends ClassFileStruct implements IConstantPool {
constantPoolEntry.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
break;
case IConstantPoolConstant.CONSTANT_Float :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setFloatValue(floatAt(this.classFileBytes, 1, this.constantPoolOffset[index]));
break;
case IConstantPoolConstant.CONSTANT_Integer :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setIntegerValue(i4At(this.classFileBytes, 1, this.constantPoolOffset[index]));
break;
case IConstantPoolConstant.CONSTANT_Long :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setLongValue(i8At(this.classFileBytes, 1, this.constantPoolOffset[index]));
break;
case IConstantPoolConstant.CONSTANT_NameAndType :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setNameAndTypeNameIndex(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
constantPoolEntry.setNameAndTypeDescriptorIndex(u2At(this.classFileBytes, 3, this.constantPoolOffset[index]));
break;
case IConstantPoolConstant.CONSTANT_String :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setStringIndex(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
constantPoolEntry.setStringValue(getUtf8ValueAt(constantPoolEntry.getStringIndex()));
break;
case IConstantPoolConstant.CONSTANT_Utf8 :
+ constantPoolEntry = new ConstantPoolEntry();
+ constantPoolEntry.reset();
+ constantPoolEntry.setKind(kind);
constantPoolEntry.setUtf8Length(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
constantPoolEntry.setUtf8Value(getUtf8ValueAt(index));
+ break;
+ case IConstantPoolConstant.CONSTANT_MethodHandle :
+ ConstantPoolEntry2 constantPoolEntry2 = new ConstantPoolEntry2();
+ constantPoolEntry2.reset();
+ constantPoolEntry2.setKind(kind);
+ constantPoolEntry2.setReferenceKind(u1At(this.classFileBytes, 1, this.constantPoolOffset[index]));
+ constantPoolEntry2.setReferenceIndex(u2At(this.classFileBytes, 2, this.constantPoolOffset[index]));
+ constantPoolEntry = constantPoolEntry2;
+ break;
+ case IConstantPoolConstant.CONSTANT_MethodType :
+ constantPoolEntry2 = new ConstantPoolEntry2();
+ constantPoolEntry2.reset();
+ constantPoolEntry2.setKind(kind);
+ methodDescriptorIndex = u2At(this.classFileBytes, 1, this.constantPoolOffset[index]);
+ constantPoolEntry2.setDescriptorIndex(methodDescriptorIndex);
+ constantPoolEntry2.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
+ constantPoolEntry = constantPoolEntry2;
+ break;
+ case IConstantPoolConstant.CONSTANT_InvokeDynamic :
+ constantPoolEntry2 = new ConstantPoolEntry2();
+ constantPoolEntry2.reset();
+ constantPoolEntry2.setKind(kind);
+ constantPoolEntry2.setBootstrapMethodAttributeIndex(u2At(this.classFileBytes, 1, this.constantPoolOffset[index]));
+ int nameAndTypeIndex = u2At(this.classFileBytes, 3, this.constantPoolOffset[index]);
+ constantPoolEntry2.setNameAndTypeIndex(nameAndTypeIndex);
+ methodNameIndex = u2At(this.classFileBytes, 1, this.constantPoolOffset[nameAndTypeIndex]);
+ methodDescriptorIndex = u2At(this.classFileBytes, 3, this.constantPoolOffset[nameAndTypeIndex]);
+ constantPoolEntry2.setMethodName(getUtf8ValueAt(methodNameIndex));
+ constantPoolEntry2.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
+ constantPoolEntry = constantPoolEntry2;
+ break;
}
return constantPoolEntry;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry.java
index 55cc17027..9f9cae664 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -341,6 +341,7 @@ public class ConstantPoolEntry implements IConstantPoolEntry {
/**
* Sets the methodDescriptor.
+ *
* @param methodDescriptor The methodDescriptor to set
*/
public void setMethodDescriptor(char[] methodDescriptor) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry2.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry2.java
new file mode 100644
index 000000000..c6c968625
--- /dev/null
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry2.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.core.util;
+
+import org.eclipse.jdt.core.util.IConstantPoolEntry2;
+
+/**
+ * Default implementation of IConstantPoolEntry
+ *
+ * @since 2.0
+ */
+public class ConstantPoolEntry2 extends ConstantPoolEntry implements IConstantPoolEntry2 {
+
+ private int descriptorIndex;
+ private int referenceKind;
+ private int referenceIndex;
+ private int bootstrapMethodAttributeIndex;
+
+ public int getDescriptorIndex() {
+ return this.descriptorIndex;
+ }
+
+ public int getReferenceKind() {
+ return this.referenceKind;
+ }
+
+ public int getReferenceIndex() {
+ return this.referenceIndex;
+ }
+
+ public int getBootstrapMethodAttributeIndex() {
+ return this.bootstrapMethodAttributeIndex;
+ }
+
+ public void setDescriptorIndex(int descriptorIndex) {
+ this.descriptorIndex = descriptorIndex;
+ }
+
+ public void setReferenceKind(int referenceKind) {
+ this.referenceKind = referenceKind;
+ }
+
+ public void setReferenceIndex(int referenceIndex) {
+ this.referenceIndex = referenceIndex;
+ }
+
+ public void setBootstrapMethodAttributeIndex(int bootstrapMethodAttributeIndex) {
+ this.bootstrapMethodAttributeIndex = bootstrapMethodAttributeIndex;
+ }
+
+ public void reset() {
+ super.reset();
+ this.descriptorIndex = 0;
+ this.referenceKind = 0;
+ this.referenceIndex = 0;
+ this.bootstrapMethodAttributeIndex = 0;
+ }
+}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java
index d94dd4e28..b5fe2abab 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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,6 +17,7 @@ import org.eclipse.jdt.core.util.IBytecodeVisitor;
import org.eclipse.jdt.core.util.ICodeAttribute;
import org.eclipse.jdt.core.util.IConstantPoolConstant;
import org.eclipse.jdt.core.util.IConstantPoolEntry;
+import org.eclipse.jdt.core.util.IConstantPoolEntry2;
import org.eclipse.jdt.core.util.ILocalVariableAttribute;
import org.eclipse.jdt.core.util.ILocalVariableTableEntry;
import org.eclipse.jdt.core.util.OpcodeStringValues;
@@ -1491,7 +1492,7 @@ public class DefaultBytecodeVisitor implements IBytecodeVisitor {
writeNewLine();
}
/**
- * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry, IConstantPoolEntry)
+ * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)
*/
public void _invokedynamic(
int pc,
@@ -1513,6 +1514,30 @@ public class DefaultBytecodeVisitor implements IBytecodeVisitor {
writeNewLine();
}
/**
+ * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)
+ */
+ public void _invokedynamic(
+ int pc,
+ int index,
+ IConstantPoolEntry invokeDynamicEntry) {
+
+ dumpPcNumber(pc);
+ IConstantPoolEntry2 entry = (IConstantPoolEntry2) invokeDynamicEntry;
+ this.buffer.append(Messages.bind(Messages.classformat_invokedynamic,
+ new String[] {
+ OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEDYNAMIC],
+ Integer.toString(index),
+ Integer.toString(entry.getBootstrapMethodAttributeIndex()),
+ Util.toString(
+ null,
+ entry.getMethodName(),
+ entry.getMethodDescriptor(),
+ true,
+ isCompact())
+ }));
+ writeNewLine();
+ }
+ /**
* @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
*/
public void _invokeinterface(
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
index c54fd7395..067a219a2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
@@ -741,7 +741,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
final int classNameLength = className.length;
final int accessFlags = classFileReader.getAccessFlags();
final boolean isEnum = (accessFlags & IModifierConstants.ACC_ENUM) != 0;
-
+
StringBuffer buffer = new StringBuffer();
ISourceAttribute sourceAttribute = classFileReader.getSourceFileAttribute();
IClassFileAttribute classFileAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.SIGNATURE);
@@ -788,7 +788,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
}
}
final int lastDotIndexInClassName = CharOperation.lastIndexOf('.', className);
-
+
if (checkMode(mode, WORKING_COPY) && lastDotIndexInClassName != -1) {
// we print a package declaration
buffer.append("package ");//$NON-NLS-1$
@@ -796,11 +796,13 @@ public class Disassembler extends ClassFileBytesDisassembler {
buffer.append(';');
writeNewLine(buffer, lineSeparator, 0);
}
-
+
IInnerClassesAttribute innerClassesAttribute = classFileReader.getInnerClassesAttribute();
IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
-
+
+ IClassFileAttribute bootstrapMethods = Util.getAttribute(classFileReader, IAttributeNamesConstants.BOOTSTRAP_METHODS);
+
if (checkMode(mode, DETAILED)) {
// disassemble compact version of annotations
if (runtimeInvisibleAnnotationsAttribute != null) {
@@ -838,7 +840,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
}
}
}
-
+
final boolean isAnnotation = (accessFlags & IModifierConstants.ACC_ANNOTATION) != 0;
boolean isInterface = false;
if (isEnum) {
@@ -852,7 +854,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
buffer.append("interface "); //$NON-NLS-1$
isInterface = true;
}
-
+
if (checkMode(mode, WORKING_COPY)) {
// we print the simple class name
final int start = lastDotIndexInClassName + 1;
@@ -864,7 +866,7 @@ public class Disassembler extends ClassFileBytesDisassembler {
} else {
buffer.append(className);
}
-
+
char[] superclassName = classFileReader.getSuperclassName();
if (superclassName != null) {
CharOperation.replace(superclassName, '/', '.');
@@ -917,8 +919,17 @@ public class Disassembler extends ClassFileBytesDisassembler {
if (signatureAttribute != null) {
remainingAttributesLength--;
}
- if (innerClassesAttribute != null || enclosingMethodAttribute != null || remainingAttributesLength != 0) {
- writeNewLine(buffer, lineSeparator, 0);
+ if (bootstrapMethods != null) {
+ remainingAttributesLength--;
+ }
+ if (innerClassesAttribute != null
+ || enclosingMethodAttribute != null
+ || bootstrapMethods != null
+ || remainingAttributesLength != 0) {
+ // this test is to ensure we don't insert more than one line separator
+ if (buffer.lastIndexOf(lineSeparator) != buffer.length() - lineSeparator.length()) {
+ writeNewLine(buffer, lineSeparator, 0);
+ }
}
if (innerClassesAttribute != null) {
disassemble(innerClassesAttribute, buffer, lineSeparator, 1);
@@ -926,6 +937,9 @@ public class Disassembler extends ClassFileBytesDisassembler {
if (enclosingMethodAttribute != null) {
disassemble(enclosingMethodAttribute, buffer, lineSeparator, 0);
}
+ if (bootstrapMethods != null) {
+ disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0);
+ }
if (checkMode(mode, SYSTEM)) {
if (runtimeVisibleAnnotationsAttribute != null) {
disassemble((IRuntimeVisibleAnnotationsAttribute) runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
@@ -937,13 +951,14 @@ public class Disassembler extends ClassFileBytesDisassembler {
for (int i = 0; i < length; i++) {
IClassFileAttribute attribute = attributes[i];
if (attribute != innerClassesAttribute
- && attribute != sourceAttribute
- && attribute != signatureAttribute
- && attribute != enclosingMethodAttribute
- && attribute != runtimeInvisibleAnnotationsAttribute
- && attribute != runtimeVisibleAnnotationsAttribute
- && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
- && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
+ && attribute != sourceAttribute
+ && attribute != signatureAttribute
+ && attribute != enclosingMethodAttribute
+ && attribute != runtimeInvisibleAnnotationsAttribute
+ && attribute != runtimeVisibleAnnotationsAttribute
+ && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
+ && !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)
+ && attribute != bootstrapMethods) {
disassemble(attribute, buffer, lineSeparator, 0, mode);
}
}
@@ -1408,9 +1423,73 @@ public class Disassembler extends ClassFileBytesDisassembler {
Integer.toString(i),
decodeStringValue(new String(constantPoolEntry.getUtf8Value()))}));
break;
+ case IConstantPoolConstant.CONSTANT_MethodHandle :
+ IConstantPoolEntry2 entry2 = (IConstantPoolEntry2) constantPoolEntry;
+ buffer.append(
+ Messages.bind(Messages.disassembler_constantpool_methodhandle,
+ new String[] {
+ Integer.toString(i),
+ getReferenceKind(entry2.getReferenceKind()),
+ Integer.toString(entry2.getReferenceIndex()),
+ }));
+ break;
+ case IConstantPoolConstant.CONSTANT_MethodType :
+ entry2 = (IConstantPoolEntry2) constantPoolEntry;
+ buffer.append(
+ Messages.bind(Messages.disassembler_constantpool_methodtype,
+ new String[] {
+ Integer.toString(i),
+ Integer.toString(entry2.getDescriptorIndex()),
+ String.valueOf(entry2.getMethodDescriptor()),
+ }));
+ break;
+ case IConstantPoolConstant.CONSTANT_InvokeDynamic :
+ entry2 = (IConstantPoolEntry2) constantPoolEntry;
+ buffer.append(
+ Messages.bind(Messages.disassembler_constantpool_invokedynamic,
+ new String[] {
+ Integer.toString(i),
+ Integer.toString(entry2.getBootstrapMethodAttributeIndex()),
+ Integer.toString(entry2.getNameAndTypeIndex()),
+ new String(constantPoolEntry.getMethodName()),
+ new String(constantPoolEntry.getMethodDescriptor())
+ }));
}
}
}
+
+ private String getReferenceKind(int referenceKind) {
+ String message = null;
+ switch(referenceKind) {
+ case IConstantPoolConstant.METHOD_TYPE_REF_GetField :
+ message = Messages.disassembler_method_type_ref_getfield;
+ break;
+ case IConstantPoolConstant.METHOD_TYPE_REF_GetStatic :
+ message = Messages.disassembler_method_type_ref_getstatic;
+ break;
+ case IConstantPoolConstant.METHOD_TYPE_REF_PutField :
+ message = Messages.disassembler_method_type_ref_putfield;
+ break;
+ case IConstantPoolConstant.METHOD_TYPE_REF_PutStatic :
+ message = Messages.disassembler_method_type_ref_putstatic;
+ break;
+ case IConstantPoolConstant.METHOD_TYPE_REF_InvokeInterface :
+ message = Messages.disassembler_method_type_ref_invokeinterface;
+ break;
+ case IConstantPoolConstant.METHOD_TYPE_REF_InvokeSpecial :
+ message = Messages.disassembler_method_type_ref_invokespecial;
+ break;
+ case IConstantPoolConstant.METHOD_TYPE_REF_InvokeStatic :
+ message = Messages.disassembler_method_type_ref_invokestatic;
+ break;
+ case IConstantPoolConstant.METHOD_TYPE_REF_InvokeVirtual :
+ message = Messages.disassembler_method_type_ref_invokevirtual;
+ break;
+ default :
+ message = Messages.disassembler_method_type_ref_newinvokespecial;
+ }
+ return Messages.bind(message, new String[] { Integer.toString(referenceKind) });
+ }
private void disassemble(IEnclosingMethodAttribute enclosingMethodAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
writeNewLine(buffer, lineSeparator, tabNumber + 1);
@@ -1669,6 +1748,46 @@ public class Disassembler extends ClassFileBytesDisassembler {
}
}
+ private void disassemble(IBootstrapMethodsAttribute bootstrapMethodsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
+ writeNewLine(buffer, lineSeparator, tabNumber);
+ buffer.append(Messages.disassembler_bootstrapmethodattributesheader);
+ writeNewLine(buffer, lineSeparator, tabNumber + 1);
+ IBootstrapMethodsEntry[] entries = bootstrapMethodsAttribute.getBootstrapMethods();
+ int length = entries.length;
+ for (int i = 0; i < length; i++) {
+ if (i != 0) {
+ buffer.append(Messages.disassembler_comma);
+ writeNewLine(buffer, lineSeparator, tabNumber + 1);
+ }
+ IBootstrapMethodsEntry entry = entries[i];
+ buffer.append(
+ Messages.bind(
+ Messages.disassembler_bootstrapmethodentry,
+ new String[] {
+ Integer.toString(i),
+ Integer.toString(entry.getBootstrapMethodReference()),
+ getArguments(entry.getBootstrapArguments())
+ }));
+ }
+ }
+
+ private String getArguments(int[] arguments) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append('{');
+ for (int i = 0, max = arguments.length; i < max; i++) {
+ if (i != 0) {
+ buffer.append(Messages.disassembler_comma);
+ }
+ buffer.append(
+ Messages.bind(
+ Messages.disassembler_bootstrapmethodentry_argument,
+ new String[] {
+ Integer.toString(arguments[i]),
+ }));
+ }
+ buffer.append('}');
+ return String.valueOf(buffer);
+ }
private void disassemble(int index, IParameterAnnotation parameterAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
IAnnotation[] annotations = parameterAnnotation.getAnnotations();
writeNewLine(buffer, lineSeparator, tabNumber + 1);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java
index 75ecbabdd..ff1cf8326 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java
@@ -259,6 +259,9 @@ public final class Messages extends NLS {
public static String disassembler_inner_accessflags;
public static String disassembler_genericattributeheader;
public static String disassembler_signatureattributeheader;
+ public static String disassembler_bootstrapmethodattributesheader;
+ public static String disassembler_bootstrapmethodentry;
+ public static String disassembler_bootstrapmethodentry_argument;
public static String disassembler_indentation;
public static String disassembler_constantpoolindex;
public static String disassembler_space;
@@ -278,6 +281,9 @@ public final class Messages extends NLS {
public static String disassembler_constantpool_methodref;
public static String disassembler_constantpool_name_and_type;
public static String disassembler_constantpool_utf8;
+ public static String disassembler_constantpool_methodhandle;
+ public static String disassembler_constantpool_methodtype;
+ public static String disassembler_constantpool_invokedynamic;
public static String disassembler_annotationdefaultheader;
public static String disassembler_annotationdefaultvalue;
public static String disassembler_annotationenumvalue;
@@ -348,6 +354,16 @@ public final class Messages extends NLS {
public static String disassembler_frame_same_frame;
public static String disassembler_frame_same_locals_1_stack_item;
public static String code_assist_internal_error;
+
+ public static String disassembler_method_type_ref_getfield;
+ public static String disassembler_method_type_ref_putfield;
+ public static String disassembler_method_type_ref_getstatic;
+ public static String disassembler_method_type_ref_putstatic;
+ public static String disassembler_method_type_ref_invokestatic;
+ public static String disassembler_method_type_ref_invokevirtual;
+ public static String disassembler_method_type_ref_invokespecial;
+ public static String disassembler_method_type_ref_invokeinterface;
+ public static String disassembler_method_type_ref_newinvokespecial;
static {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties
index e75e56ba7..5af88dbe8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties
@@ -285,6 +285,9 @@ disassembler_genericattributeheader = Attribute: {0} Length: {1}
disassembler_stackmaptableattributeheader = Stack map table: number of frames {0}
disassembler_stackmapattributeheader = Stack map : number of frames {0}
disassembler_signatureattributeheader = // Signature: {0}
+disassembler_bootstrapmethodattributesheader = Bootstrap methods:
+disassembler_bootstrapmethodentry = {0} : # {1} arguments: {2}
+disassembler_bootstrapmethodentry_argument = #{0}
disassembler_indentation = \
disassembler_constantpoolindex =\ #
disassembler_space = \
@@ -304,6 +307,9 @@ disassembler_constantpool_interfacemethodref = constant #{0} interface_method_re
disassembler_constantpool_methodref = constant #{0} method_ref: #{1}.#{2} {3}.{4} {5}
disassembler_constantpool_name_and_type = constant #{0} name_and_type: #{1}.#{2} {3} {4}
disassembler_constantpool_utf8 = constant #{0} utf8: "{1}"
+disassembler_constantpool_methodhandle = constant #{0} method handle: {1} #{2}
+disassembler_constantpool_methodtype = constant #{0} method type: #{1} {2}
+disassembler_constantpool_invokedynamic = constant #{0} invoke dynamic: #{1} #{2} {3} {4}
disassembler_annotationdefaultheader = Annotation Default:\
disassembler_annotationdefaultvalue= {0} (constant type)
disassembler_annotationenumvalue = {2}.{3}(enum type #{0}.#{1})
@@ -323,6 +329,15 @@ disassembler_frame_same_locals_1_stack_item_extended=[pc: {0}, same_locals_1_sta
disassembler_frame_chop=[pc: {0}, chop {1} local(s)]
disassembler_frame_same_frame_extended=[pc: {0}, same_extended]
disassembler_frame_append=[pc: {0}, append: {1}]
+disassembler_method_type_ref_getfield = getfield ({0})
+disassembler_method_type_ref_putfield = putfield ({0})
+disassembler_method_type_ref_getstatic = getstatic ({0})
+disassembler_method_type_ref_putstatic = putstatic ({0})
+disassembler_method_type_ref_invokestatic = invokestatic ({0})
+disassembler_method_type_ref_invokevirtual = invokevirtual ({0})
+disassembler_method_type_ref_invokeinterface = invokeinterface ({0})
+disassembler_method_type_ref_invokespecial = invokespecial ({0})
+disassembler_method_type_ref_newinvokespecial = newinvokespecial ({0})
# {0} = offset delta
# {1} = number of locals
# {2} = locals
@@ -358,7 +373,7 @@ classformat_new = {0} {2} [{1}]
classformat_iinc = {0} {1} {2}{3}
classformat_invokespecial ={0} {2} [{1}]
classformat_invokeinterface ={0} {3} [{1}] [nargs: {2}]
-classformat_invokedynamic={0} {2} [{1}]
+classformat_invokedynamic={0} {2} {3} [{1}]
classformat_invokestatic ={0} {2} [{1}]
classformat_invokevirtual ={0} {2} [{1}]
classformat_getfield ={0} {2}.{3} : {4} [{1}]

Back to the top