View | Details | Raw Unified | Return to bug 359943 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 58-63 public interface ClassFileConstants { Link Here
58
	int MethodRefTag = 10;
58
	int MethodRefTag = 10;
59
	int InterfaceMethodRefTag = 11;
59
	int InterfaceMethodRefTag = 11;
60
	int NameAndTypeTag = 12;
60
	int NameAndTypeTag = 12;
61
	int MethodHandleTag = 15;
62
	int MethodTypeTag = 16;
63
	int InvokeDynamicTag = 18;
61
64
62
	int ConstantMethodRefFixedSize = 5;
65
	int ConstantMethodRefFixedSize = 5;
63
	int ConstantClassFixedSize = 3;
66
	int ConstantClassFixedSize = 3;
Lines 70-75 public interface ClassFileConstants { Link Here
70
	int ConstantStringFixedSize = 3;
73
	int ConstantStringFixedSize = 3;
71
	int ConstantUtf8FixedSize = 3;
74
	int ConstantUtf8FixedSize = 3;
72
	int ConstantNameAndTypeFixedSize = 5;
75
	int ConstantNameAndTypeFixedSize = 5;
76
	int ConstantMethodHandleFixedSize = 4;
77
	int ConstantMethodTypeFixedSize = 3;
78
	int ConstantInvokeDynamicFixedSize = 5;
73
79
74
	int MAJOR_VERSION_1_1 = 45;
80
	int MAJOR_VERSION_1_1 = 45;
75
	int MAJOR_VERSION_1_2 = 46;
81
	int MAJOR_VERSION_1_2 = 46;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java (-1 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 207-212 public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit Link Here
207
				case ClassFileConstants.NameAndTypeTag :
207
				case ClassFileConstants.NameAndTypeTag :
208
					this.constantPoolOffsets[i] = readOffset;
208
					this.constantPoolOffsets[i] = readOffset;
209
					readOffset += ClassFileConstants.ConstantNameAndTypeFixedSize;
209
					readOffset += ClassFileConstants.ConstantNameAndTypeFixedSize;
210
					break;
211
				case ClassFileConstants.MethodHandleTag :
212
					this.constantPoolOffsets[i] = readOffset;
213
					readOffset += ClassFileConstants.ConstantMethodHandleFixedSize;
214
					break;
215
				case ClassFileConstants.MethodTypeTag :
216
					this.constantPoolOffsets[i] = readOffset;
217
					readOffset += ClassFileConstants.ConstantMethodTypeFixedSize;
218
					break;
219
				case ClassFileConstants.InvokeDynamicTag :
220
					this.constantPoolOffsets[i] = readOffset;
221
					readOffset += ClassFileConstants.ConstantInvokeDynamicFixedSize;
222
					break;
210
			}
223
			}
211
		}
224
		}
212
		// Read and validate access flags
225
		// Read and validate access flags
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ByteCodeVisitorAdapter.java (-2 / +13 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 923-930 public class ByteCodeVisitorAdapter implements IBytecodeVisitor { Link Here
923
		// default behavior is to do nothing
923
		// default behavior is to do nothing
924
	}
924
	}
925
	/**
925
	/**
926
	 * @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
926
	 * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry, IConstantPoolEntry)
927
	 * @since 3.6
927
	 * @since 3.6
928
	 * @deprecated This has been replaced with {@link IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)}
928
	 */
929
	 */
929
	public void _invokedynamic(
930
	public void _invokedynamic(
930
			int pc,
931
			int pc,
Lines 934-939 public class ByteCodeVisitorAdapter implements IBytecodeVisitor { Link Here
934
		// default behavior is to do nothing
935
		// default behavior is to do nothing
935
	}
936
	}
936
	/**
937
	/**
938
	 * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)
939
	 * @since 3.8
940
	 */
941
	public void _invokedynamic(
942
			int pc,
943
			int index,
944
			IConstantPoolEntry invokeDynamicEntry) {
945
		// default behavior is to do nothing
946
	}
947
	/**
937
	 * @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
948
	 * @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
938
	 */
949
	 */
939
	public void _invokeinterface(
950
	public void _invokeinterface(
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java (-1 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 140-143 public interface IAttributeNamesConstants { Link Here
140
	 * @since 3.2
140
	 * @since 3.2
141
	 */
141
	 */
142
	char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$
142
	char[] STACK_MAP = "StackMap".toCharArray(); //$NON-NLS-1$
143
	
144
	/**
145
	 * "BootstrapMethods" attribute (added in cldc1.0).
146
	 * @since 3.8
147
	 */
148
	char[] BOOTSTRAP_METHODS = "BootstrapMethods".toCharArray(); //$NON-NLS-1$
143
}
149
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsAttribute.java (+40 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
/**
14
 * Description of a bootstrap methods attribute as described in the JVM specifications.
15
 *
16
 * This interface may be implemented by clients.
17
 *
18
 * @since 3.8
19
 */
20
public interface IBootstrapMethodsAttribute extends IClassFileAttribute {
21
22
	/**
23
	 * Answer back the number of bootstrap methods of this entry as specified in
24
	 * the JVM specifications.
25
	 *
26
	 * @return the local variable table length of this entry as specified in
27
	 * the JVM specifications
28
	 */
29
	int getBootstrapMethodsLength();
30
31
	/**
32
	 * Answer back the bootstrap methods table of this entry as specified in
33
	 * the JVM specifications. Answer an empty array if none.
34
	 *
35
	 * @return the bootstrap methods table of this entry as specified in
36
	 * the JVM specifications. Answer an empty array if none
37
	 */
38
	IBootstrapMethodsEntry[] getBootstrapMethods();
39
40
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsEntry.java (+24 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
/**
14
 * Description of a bootstrap method table entry as specified in the JVM specifications.
15
 *
16
 * This interface may be implemented by clients.
17
 *
18
 * @since 3.8
19
 */
20
public interface IBootstrapMethodsEntry {
21
22
	int getBootstrapMethodReference();
23
	int[] getBootstrapArguments();
24
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBytecodeVisitor.java (-1 / +9 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 168-179 public interface IBytecodeVisitor { Link Here
168
		IConstantPoolEntry constantClass);
168
		IConstantPoolEntry constantClass);
169
	/**
169
	/**
170
	 * @since 3.6
170
	 * @since 3.6
171
	 * @deprecated This has been replaced with {@link #_invokedynamic(int, int, IConstantPoolEntry)}
171
	 */
172
	 */
172
	void _invokedynamic(
173
	void _invokedynamic(
173
			int pc,
174
			int pc,
174
			int index,
175
			int index,
175
			IConstantPoolEntry nameEntry,
176
			IConstantPoolEntry nameEntry,
176
			IConstantPoolEntry descriptorEntry);
177
			IConstantPoolEntry descriptorEntry);
178
	/**
179
	 * @since 3.8
180
	 */
181
	void _invokedynamic(
182
			int pc,
183
			int index,
184
			IConstantPoolEntry invokeDynamic);
177
	void _invokeinterface(
185
	void _invokeinterface(
178
		int pc,
186
		int pc,
179
		int index,
187
		int index,
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java (-6 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 27-34 public interface IConstantPool { Link Here
27
	int getConstantPoolCount();
27
	int getConstantPoolCount();
28
28
29
	/**
29
	/**
30
	 * Answer back the type of the entry at the index @index
30
	 * Answer back the type of the entry at the given index in the constant pool.
31
	 * in the constant pool.
32
	 *
31
	 *
33
	 * @param index the index of the entry in the constant pool
32
	 * @param index the index of the entry in the constant pool
34
	 * @return the type of the entry at the index @index in the constant pool
33
	 * @return the type of the entry at the index @index in the constant pool
Lines 36-46 public interface IConstantPool { Link Here
36
	int getEntryKind(int index);
35
	int getEntryKind(int index);
37
36
38
	/**
37
	/**
39
	 * Answer back the entry at the index @index
38
	 * Answer back the entry at the given index in the constant pool.
40
	 * in the constant pool.
39
	 * 
40
	 * <p>The return value can be an instance of {@link IConstantPoolEntry2} if the value returned
41
	 * by {@link #getEntryKind(int)} is either {@link IConstantPoolConstant#CONSTANT_MethodHandle},
42
	 * {@link IConstantPoolConstant#CONSTANT_MethodType} or {@link IConstantPoolConstant#CONSTANT_InvokeDynamic}.</p>
41
	 *
43
	 *
42
	 * @param index the index of the entry in the constant pool
44
	 * @param index the index of the entry in the constant pool
43
	 * @return the entry at the index @index in the constant pool
45
	 * @return the entry at the given index in the constant pool
44
	 */
46
	 */
45
	IConstantPoolEntry decodeEntry(int index);
47
	IConstantPoolEntry decodeEntry(int index);
46
}
48
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java (-1 / +70 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 29-34 public interface IConstantPoolConstant { Link Here
29
	int CONSTANT_Double = 6;
29
	int CONSTANT_Double = 6;
30
	int CONSTANT_NameAndType = 12;
30
	int CONSTANT_NameAndType = 12;
31
	int CONSTANT_Utf8 = 1;
31
	int CONSTANT_Utf8 = 1;
32
	/**
33
	 * @since 3.8
34
	 */
35
	int CONSTANT_MethodHandle = 15;
36
	/**
37
	 * @since 3.8
38
	 */
39
	int CONSTANT_MethodType = 16;
40
	/**
41
	 * @since 3.8
42
	 */
43
	int CONSTANT_InvokeDynamic = 18;
32
44
33
	int CONSTANT_Methodref_SIZE = 5;
45
	int CONSTANT_Methodref_SIZE = 5;
34
	int CONSTANT_Class_SIZE = 3;
46
	int CONSTANT_Class_SIZE = 3;
Lines 41-45 public interface IConstantPoolConstant { Link Here
41
	int CONSTANT_String_SIZE = 3;
53
	int CONSTANT_String_SIZE = 3;
42
	int CONSTANT_Utf8_SIZE = 3;
54
	int CONSTANT_Utf8_SIZE = 3;
43
	int CONSTANT_NameAndType_SIZE = 5;
55
	int CONSTANT_NameAndType_SIZE = 5;
56
	/**
57
	 * @since 3.8
58
	 */
59
	int CONSTANT_MethodHandle_SIZE = 4;
60
	/**
61
	 * @since 3.8
62
	 */
63
	int CONSTANT_MethodType_SIZE = 3;
64
	/**
65
	 * @since 3.8
66
	 */
67
	int CONSTANT_InvokeDynamic_SIZE = 5;
44
68
69
	/**
70
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
71
	 * @since 3.8
72
	 */
73
	int METHOD_TYPE_REF_GetField = 1;
74
	/**
75
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
76
	 * @since 3.8
77
	 */
78
	int METHOD_TYPE_REF_GetStatic = 2;
79
	/**
80
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
81
	 * @since 3.8
82
	 */
83
	int METHOD_TYPE_REF_PutField = 3;
84
	/**
85
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
86
	 * @since 3.8
87
	 */
88
	int METHOD_TYPE_REF_PutStatic = 4;
89
	/**
90
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
91
	 * @since 3.8
92
	 */
93
	int METHOD_TYPE_REF_InvokeVirtual = 5;
94
	/**
95
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
96
	 * @since 3.8
97
	 */
98
	int METHOD_TYPE_REF_InvokeStatic = 6;
99
	/**
100
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
101
	 * @since 3.8
102
	 */
103
	int METHOD_TYPE_REF_InvokeSpecial = 7;
104
	/**
105
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
106
	 * @since 3.8
107
	 */
108
	int METHOD_TYPE_REF_NewInvokeSpecial = 8;
109
	/**
110
	 * The constant is described at 5.4.3.5 in the Java 7 VM specification (part 3).
111
	 * @since 3.8
112
	 */
113
	int METHOD_TYPE_REF_InvokeInterface = 9;
45
}
114
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java (-10 / +47 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 32-37 public interface IConstantPoolEntry { Link Here
32
	 * The value is unspecified otherwise.
32
	 * The value is unspecified otherwise.
33
	 *
33
	 *
34
	 * @return the name index for a CONSTANT_Class type entry
34
	 * @return the name index for a CONSTANT_Class type entry
35
	 * @see IConstantPoolConstant#CONSTANT_Class
35
	 */
36
	 */
36
	int getClassInfoNameIndex();
37
	int getClassInfoNameIndex();
37
38
Lines 42-57 public interface IConstantPoolEntry { Link Here
42
	 *
43
	 *
43
	 * @return the class index for a CONSTANT_Fieldref,
44
	 * @return the class index for a CONSTANT_Fieldref,
44
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
45
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
46
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
47
	 * @see IConstantPoolConstant#CONSTANT_Methodref
48
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
45
	 */
49
	 */
46
	int getClassIndex();
50
	int getClassIndex();
47
51
48
	/**
52
	/**
49
	 * Returns the nameAndType index for a CONSTANT_Fieldref,
53
	 * Returns the nameAndType index for a CONSTANT_Fieldref,
50
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry.
54
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref,
55
	 * CONSTANT_InvokeDynamic type entry.
51
	 * The value is unspecified otherwise.
56
	 * The value is unspecified otherwise.
52
	 *
57
	 *
53
	 * @return the nameAndType index for a CONSTANT_Fieldref,
58
	 * @return the nameAndType index for a CONSTANT_Fieldref,
54
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
59
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref,
60
	 * CONSTANT_InvokeDynamic type entry
61
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
62
	 * @see IConstantPoolConstant#CONSTANT_Methodref
63
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
64
	 * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
55
	 */
65
	 */
56
	int getNameAndTypeIndex();
66
	int getNameAndTypeIndex();
57
67
Lines 60-65 public interface IConstantPoolEntry { Link Here
60
	 * The value is unspecified otherwise.
70
	 * The value is unspecified otherwise.
61
	 *
71
	 *
62
	 * @return the string index for a CONSTANT_String type entry
72
	 * @return the string index for a CONSTANT_String type entry
73
	 * @see IConstantPoolConstant#CONSTANT_String
63
	 */
74
	 */
64
	int getStringIndex();
75
	int getStringIndex();
65
76
Lines 68-73 public interface IConstantPoolEntry { Link Here
68
	 * Returns null otherwise.
79
	 * Returns null otherwise.
69
	 *
80
	 *
70
	 * @return the string value for a CONSTANT_String type entry
81
	 * @return the string value for a CONSTANT_String type entry
82
	 * @see IConstantPoolConstant#CONSTANT_String
71
	 */
83
	 */
72
	String getStringValue();
84
	String getStringValue();
73
85
Lines 76-81 public interface IConstantPoolEntry { Link Here
76
	 * The value is unspecified otherwise.
88
	 * The value is unspecified otherwise.
77
	 *
89
	 *
78
	 * @return the integer value for a CONSTANT_Integer type entry
90
	 * @return the integer value for a CONSTANT_Integer type entry
91
	 * @see IConstantPoolConstant#CONSTANT_Integer
79
	 */
92
	 */
80
	int getIntegerValue();
93
	int getIntegerValue();
81
94
Lines 84-89 public interface IConstantPoolEntry { Link Here
84
	 * The value is unspecified otherwise.
97
	 * The value is unspecified otherwise.
85
	 *
98
	 *
86
	 * @return the float value for a CONSTANT_Float type entry
99
	 * @return the float value for a CONSTANT_Float type entry
100
	 * @see IConstantPoolConstant#CONSTANT_Float
87
	 */
101
	 */
88
	float getFloatValue();
102
	float getFloatValue();
89
103
Lines 92-97 public interface IConstantPoolEntry { Link Here
92
	 * The value is unspecified otherwise.
106
	 * The value is unspecified otherwise.
93
	 *
107
	 *
94
	 * @return the double value for a CONSTANT_Double type entry
108
	 * @return the double value for a CONSTANT_Double type entry
109
	 * @see IConstantPoolConstant#CONSTANT_Double
95
	 */
110
	 */
96
	double getDoubleValue();
111
	double getDoubleValue();
97
112
Lines 100-105 public interface IConstantPoolEntry { Link Here
100
	 * The value is unspecified otherwise.
115
	 * The value is unspecified otherwise.
101
	 *
116
	 *
102
	 * @return the long value for a CONSTANT_Long type entry
117
	 * @return the long value for a CONSTANT_Long type entry
118
	 * @see IConstantPoolConstant#CONSTANT_Long
103
	 */
119
	 */
104
	long getLongValue();
120
	long getLongValue();
105
121
Lines 108-113 public interface IConstantPoolEntry { Link Here
108
	 * The value is unspecified otherwise.
124
	 * The value is unspecified otherwise.
109
	 *
125
	 *
110
	 * @return the descriptor index for a CONSTANT_NameAndType type entry
126
	 * @return the descriptor index for a CONSTANT_NameAndType type entry
127
	 * @see IConstantPoolConstant#CONSTANT_NameAndType
111
	 */
128
	 */
112
	int getNameAndTypeInfoDescriptorIndex();
129
	int getNameAndTypeInfoDescriptorIndex();
113
130
Lines 116-121 public interface IConstantPoolEntry { Link Here
116
	 * The value is unspecified otherwise.
133
	 * The value is unspecified otherwise.
117
	 *
134
	 *
118
	 * @return the name index for a CONSTANT_NameAndType type entry
135
	 * @return the name index for a CONSTANT_NameAndType type entry
136
	 * @see IConstantPoolConstant#CONSTANT_NameAndType
119
	 */
137
	 */
120
	int getNameAndTypeInfoNameIndex();
138
	int getNameAndTypeInfoNameIndex();
121
139
Lines 124-129 public interface IConstantPoolEntry { Link Here
124
	 * Returns null otherwise.
142
	 * Returns null otherwise.
125
	 *
143
	 *
126
	 * @return the class name for a CONSTANT_Class type entry
144
	 * @return the class name for a CONSTANT_Class type entry
145
	 * @see IConstantPoolConstant#CONSTANT_Class
127
	 */
146
	 */
128
	char[] getClassInfoName();
147
	char[] getClassInfoName();
129
148
Lines 134-139 public interface IConstantPoolEntry { Link Here
134
	 *
153
	 *
135
	 * @return the class name for a CONSTANT_Fieldref,
154
	 * @return the class name for a CONSTANT_Fieldref,
136
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
155
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref type entry
156
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
157
	 * @see IConstantPoolConstant#CONSTANT_Methodref
158
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
137
	 */
159
	 */
138
	char[] getClassName();
160
	char[] getClassName();
139
161
Lines 142-157 public interface IConstantPoolEntry { Link Here
142
	 * Returns null otherwise.
164
	 * Returns null otherwise.
143
	 *
165
	 *
144
	 * @return the field name for a CONSTANT_Fieldref type entry
166
	 * @return the field name for a CONSTANT_Fieldref type entry
167
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
145
	 */
168
	 */
146
	char[] getFieldName();
169
	char[] getFieldName();
147
170
148
	/**
171
	/**
149
	 * Returns the field name for a CONSTANT_Methodref or CONSTANT_InterfaceMethodred
172
	 * Returns the field name for a CONSTANT_Methodref, CONSTANT_InterfaceMethodref
150
	 * type entry.
173
	 * or CONSTANT_InvokeDynamic type entry.
151
	 * Returns null otherwise.
174
	 * Returns null otherwise.
152
	 *
175
	 *
153
	 * @return the field name for a CONSTANT_Methodref or CONSTANT_InterfaceMethodred
176
	 * @return the method name for a CONSTANT_Methodref, CONSTANT_InterfaceMethodref
154
	 * type entry
177
	 * or CONSTANT_InvokeDynamic type entry
178
	 * @see IConstantPoolConstant#CONSTANT_Methodref
179
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
180
	 * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
155
	 */
181
	 */
156
	char[] getMethodName();
182
	char[] getMethodName();
157
183
Lines 162-179 public interface IConstantPoolEntry { Link Here
162
	 *
188
	 *
163
	 * @return the field descriptor value for a CONSTANT_Fieldref type entry. This value
189
	 * @return the field descriptor value for a CONSTANT_Fieldref type entry. This value
164
	 * is set only when decoding the CONSTANT_Fieldref entry
190
	 * is set only when decoding the CONSTANT_Fieldref entry
191
	 * @see IConstantPoolConstant#CONSTANT_Fieldref
165
	 */
192
	 */
166
	char[] getFieldDescriptor();
193
	char[] getFieldDescriptor();
167
194
168
	/**
195
	/**
169
	 * Returns the method descriptor value for a CONSTANT_Methodref or
196
	 * Returns the method descriptor value for a CONSTANT_Methodref or
170
	 * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
197
	 * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
171
	 * CONSTANT_Methodref or CONSTANT_InterfaceMethodref entry.
198
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref, CONSTANT_MethodType
199
	 * or CONSTANT_InvokeDynamic entry.
200
	 * 
172
	 * Returns null otherwise.
201
	 * Returns null otherwise.
173
	 *
202
	 *
174
	 * @return the method descriptor value for a CONSTANT_Methodref or
203
	 * @return the method descriptor value for a CONSTANT_Methodref,
175
	 * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
204
	 * CONSTANT_InterfaceMethodref type entry. This value is set only when decoding the
176
	 * CONSTANT_Methodref or CONSTANT_InterfaceMethodref entry
205
	 * CONSTANT_Methodref, CONSTANT_InterfaceMethodref, CONSTANT_MethodType
206
	 * or CONSTANT_InvokeDynamic entry
207
	 *
208
	 * @see IConstantPoolConstant#CONSTANT_Methodref
209
	 * @see IConstantPoolConstant#CONSTANT_InterfaceMethodref
210
	 * @see IConstantPoolConstant#CONSTANT_MethodType
211
	 * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
177
	 */
212
	 */
178
	char[] getMethodDescriptor();
213
	char[] getMethodDescriptor();
179
214
Lines 184-189 public interface IConstantPoolEntry { Link Here
184
	 *
219
	 *
185
	 * @return the utf8 value for a CONSTANT_Utf8 type entry. This value is set only when
220
	 * @return the utf8 value for a CONSTANT_Utf8 type entry. This value is set only when
186
	 * decoding a UTF8 entry
221
	 * decoding a UTF8 entry
222
	 * @see IConstantPoolConstant#CONSTANT_Utf8
187
	 */
223
	 */
188
	char[] getUtf8Value();
224
	char[] getUtf8Value();
189
225
Lines 194-199 public interface IConstantPoolEntry { Link Here
194
	 *
230
	 *
195
	 * @return the utf8 length for a CONSTANT_Utf8 type entry. This value is set only when
231
	 * @return the utf8 length for a CONSTANT_Utf8 type entry. This value is set only when
196
	 * decoding a UTF8 entry
232
	 * decoding a UTF8 entry
233
	 * @see IConstantPoolConstant#CONSTANT_Utf8
197
	 */
234
	 */
198
	int getUtf8Length();
235
	int getUtf8Length();
199
}
236
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java (+59 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.util;
12
13
/**
14
 * Description of the new constant pool entry as described in the JVM specifications
15
 * added for Java 7 support.
16
 * Its contents is initialized according to its kind.
17
 *
18
 * This interface may be implemented by clients.
19
 *
20
 * @since 3.8
21
 */
22
public interface IConstantPoolEntry2 extends IConstantPoolEntry {
23
	/**
24
	 * Returns the descriptor index. This value is set only when decoding a MethodType entry.
25
	 * The value is unspecified otherwise. The corresponding UTF8 value can be retrieved by using
26
	 * {@link #getMethodDescriptor()}.
27
	 *
28
	 * @return the descriptor index. This value is set only when decoding a MethodType entry.
29
	 * @see IConstantPoolConstant#CONSTANT_MethodType
30
	 */
31
	int getDescriptorIndex();
32
33
	/**
34
	 * Returns the reference kind. This value is set only when decoding a MethodHandle entry.
35
	 * The value is unspecified otherwise.
36
	 *
37
	 * @return the reference kind. This value is set only when decoding a MethodHandle entry.
38
	 * @see IConstantPoolConstant#CONSTANT_MethodHandle
39
	 */
40
	int getReferenceKind();
41
42
	/**
43
	 * Returns the reference index. This value is set only when decoding a MethodHandle entry.
44
	 * The value is unspecified otherwise.
45
	 *
46
	 * @return the reference kind. This value is set only when decoding a MethodHandle entry.
47
	 * @see IConstantPoolConstant#CONSTANT_MethodHandle
48
	 */
49
	int getReferenceIndex();
50
	
51
	/**
52
	 * Returns the bootstrap method attribute index. This value is set only when decoding a InvokeDynamic entry.
53
	 * The value is unspecified otherwise.
54
	 *
55
	 * @return the reference kind. This value is set only when decoding a MethodHandle entry.
56
	 * @see IConstantPoolConstant#CONSTANT_InvokeDynamic
57
	 */
58
	int getBootstrapMethodAttributeIndex();
59
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsAttribute.java (+63 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.util;
12
13
import org.eclipse.jdt.core.util.ClassFormatException;
14
import org.eclipse.jdt.core.util.IBootstrapMethodsAttribute;
15
import org.eclipse.jdt.core.util.IBootstrapMethodsEntry;
16
import org.eclipse.jdt.core.util.IConstantPool;
17
18
/**
19
 * Default implementation of IBootstrapMethodsAttribute.
20
 */
21
public class BootstrapMethodsAttribute extends ClassFileAttribute implements IBootstrapMethodsAttribute {
22
	private static final IBootstrapMethodsEntry[] NO_ENTRIES = new IBootstrapMethodsEntry[0];
23
24
	private IBootstrapMethodsEntry[] entries;
25
	private int numberOfBootstrapMethods;
26
27
	/**
28
	 * Constructor for BootstrapMethodsAttribute.
29
	 * @param classFileBytes
30
	 * @param constantPool
31
	 * @param offset
32
	 * @throws ClassFormatException
33
	 */
34
	public BootstrapMethodsAttribute(
35
			byte[] classFileBytes,
36
			IConstantPool constantPool,
37
			int offset) throws ClassFormatException {
38
		super(classFileBytes, constantPool, offset);
39
		this.numberOfBootstrapMethods = u2At(classFileBytes, 6, offset);
40
		final int length = this.numberOfBootstrapMethods;
41
		if (length != 0) {
42
			int readOffset = 8;
43
			this.entries = new IBootstrapMethodsEntry[length];
44
			for (int i = 0; i < length; i++) {
45
				this.entries[i] = new BootstrapMethodsEntry(classFileBytes, constantPool, offset + readOffset);
46
				readOffset += 8;
47
			}
48
		} else {
49
			this.entries = NO_ENTRIES;
50
		}
51
	}
52
53
	/**
54
	 * @see IBootstrapMethodsAttribute#getBootstrapMethods()
55
	 */
56
	public IBootstrapMethodsEntry[] getBootstrapMethods() {
57
		return this.entries;
58
	}
59
	
60
	public int getBootstrapMethodsLength() {
61
		return this.numberOfBootstrapMethods;
62
	}
63
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsEntry.java (+52 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.util;
12
13
import org.eclipse.jdt.core.util.ClassFormatException;
14
import org.eclipse.jdt.core.util.IBootstrapMethodsEntry;
15
import org.eclipse.jdt.core.util.IConstantPool;
16
17
/**
18
 * Default implementation of {@link IBootstrapMethodsEntry}
19
 */
20
public class BootstrapMethodsEntry
21
	extends ClassFileStruct
22
	implements IBootstrapMethodsEntry {
23
24
	private int bootstrapMethodReference;
25
	private int[] bootstrapArguments;
26
27
	public BootstrapMethodsEntry(byte classFileBytes[], IConstantPool constantPool, int offset) throws ClassFormatException {
28
		this.bootstrapMethodReference = u2At(classFileBytes, 0, offset);
29
		int length = u2At(classFileBytes, 2, offset);
30
		int[] arguments = new int[length];
31
		int position = 4;
32
		for (int i = 0; i < length; i++) {
33
			arguments[i] = u2At(classFileBytes, position, offset);
34
			position += 2;
35
		}
36
		this.bootstrapArguments = arguments;
37
	}
38
39
	/**
40
	 * @see IBootstrapMethodsEntry#getBootstrapArguments()
41
	 */
42
	public int[] getBootstrapArguments() {
43
		return this.bootstrapArguments;
44
	}
45
46
	/**
47
	 * @see IBootstrapMethodsEntry#getBootstrapMethodReference()
48
	 */
49
	public int getBootstrapMethodReference() {
50
		return this.bootstrapMethodReference;
51
	}
52
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java (-1 / +15 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 140-145 public class ClassFileReader extends ClassFileStruct implements IClassFileReader Link Here
140
						constantPoolOffsets[i] = readOffset;
140
						constantPoolOffsets[i] = readOffset;
141
						readOffset += IConstantPoolConstant.CONSTANT_NameAndType_SIZE;
141
						readOffset += IConstantPoolConstant.CONSTANT_NameAndType_SIZE;
142
						break;
142
						break;
143
					case IConstantPoolConstant.CONSTANT_MethodHandle :
144
						constantPoolOffsets[i] = readOffset;
145
						readOffset += IConstantPoolConstant.CONSTANT_MethodHandle_SIZE;
146
						break;
147
					case IConstantPoolConstant.CONSTANT_MethodType :
148
						constantPoolOffsets[i] = readOffset;
149
						readOffset += IConstantPoolConstant.CONSTANT_MethodType_SIZE;
150
						break;
151
					case IConstantPoolConstant.CONSTANT_InvokeDynamic :
152
						constantPoolOffsets[i] = readOffset;
153
						readOffset += IConstantPoolConstant.CONSTANT_InvokeDynamic_SIZE;
154
						break;
143
					default:
155
					default:
144
						throw new ClassFormatException(ClassFormatException.INVALID_TAG_CONSTANT);
156
						throw new ClassFormatException(ClassFormatException.INVALID_TAG_CONSTANT);
145
				}
157
				}
Lines 261-266 public class ClassFileReader extends ClassFileStruct implements IClassFileReader Link Here
261
							this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
273
							this.attributes[attributesIndex++] = new RuntimeVisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
262
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
274
						} else if (equals(attributeName, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS)) {
263
							this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
275
							this.attributes[attributesIndex++] = new RuntimeInvisibleAnnotationsAttribute(classFileBytes, this.constantPool, readOffset);
276
						} else if (equals(attributeName, IAttributeNamesConstants.BOOTSTRAP_METHODS)) {
277
							this.attributes[attributesIndex++] = new BootstrapMethodsAttribute(classFileBytes, this.constantPool, readOffset);
264
						} else {
278
						} else {
265
							this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
279
							this.attributes[attributesIndex++] = new ClassFileAttribute(classFileBytes, this.constantPool, readOffset);
266
						}
280
						}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java (-4 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1049-1062 public class CodeAttribute extends ClassFileAttribute implements ICodeAttribute Link Here
1049
				case IOpcodeMnemonics.INVOKEDYNAMIC :
1049
				case IOpcodeMnemonics.INVOKEDYNAMIC :
1050
					index = u2At(this.classFileBytes, 1, pc);
1050
					index = u2At(this.classFileBytes, 1, pc);
1051
					constantPoolEntry = this.constantPool.decodeEntry(index);
1051
					constantPoolEntry = this.constantPool.decodeEntry(index);
1052
					if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_NameAndType) {
1052
					if (constantPoolEntry.getKind() != IConstantPoolConstant.CONSTANT_InvokeDynamic) {
1053
						throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
1053
						throw new ClassFormatException(ClassFormatException.INVALID_CONSTANT_POOL_ENTRY);
1054
					}
1054
					}
1055
					visitor._invokedynamic(
1055
					visitor._invokedynamic(
1056
							pc - this.codeOffset,
1056
							pc - this.codeOffset,
1057
							index,
1057
							index,
1058
							this.constantPool.decodeEntry(constantPoolEntry.getNameAndTypeInfoNameIndex()),
1058
							constantPoolEntry);
1059
							this.constantPool.decodeEntry(constantPoolEntry.getNameAndTypeInfoDescriptorIndex()));
1060
					pc += 5;
1059
					pc += 5;
1061
					break;
1060
					break;
1062
				case IOpcodeMnemonics.NEW :
1061
				case IOpcodeMnemonics.NEW :
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java (-4 / +69 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 33-51 public class ConstantPool extends ClassFileStruct implements IConstantPool { Link Here
33
	 * @see IConstantPool#decodeEntry(int)
33
	 * @see IConstantPool#decodeEntry(int)
34
	 */
34
	 */
35
	public IConstantPoolEntry decodeEntry(int index) {
35
	public IConstantPoolEntry decodeEntry(int index) {
36
		ConstantPoolEntry constantPoolEntry = new ConstantPoolEntry();
36
		ConstantPoolEntry constantPoolEntry = null;
37
		constantPoolEntry.reset();
38
		int kind = getEntryKind(index);
37
		int kind = getEntryKind(index);
39
		constantPoolEntry.setKind(kind);
40
		switch(kind) {
38
		switch(kind) {
41
			case IConstantPoolConstant.CONSTANT_Class :
39
			case IConstantPoolConstant.CONSTANT_Class :
40
				constantPoolEntry = new ConstantPoolEntry();
41
				constantPoolEntry.reset();
42
				constantPoolEntry.setKind(kind);
42
				constantPoolEntry.setClassInfoNameIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
43
				constantPoolEntry.setClassInfoNameIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
43
				constantPoolEntry.setClassInfoName(getUtf8ValueAt(constantPoolEntry.getClassInfoNameIndex()));
44
				constantPoolEntry.setClassInfoName(getUtf8ValueAt(constantPoolEntry.getClassInfoNameIndex()));
44
				break;
45
				break;
45
			case IConstantPoolConstant.CONSTANT_Double :
46
			case IConstantPoolConstant.CONSTANT_Double :
47
				constantPoolEntry = new ConstantPoolEntry();
48
				constantPoolEntry.reset();
49
				constantPoolEntry.setKind(kind);
46
				constantPoolEntry.setDoubleValue(doubleAt(this.classFileBytes, 1, this.constantPoolOffset[index]));
50
				constantPoolEntry.setDoubleValue(doubleAt(this.classFileBytes, 1, this.constantPoolOffset[index]));
47
				break;
51
				break;
48
			case IConstantPoolConstant.CONSTANT_Fieldref :
52
			case IConstantPoolConstant.CONSTANT_Fieldref :
53
				constantPoolEntry = new ConstantPoolEntry();
54
				constantPoolEntry.reset();
55
				constantPoolEntry.setKind(kind);
56
				constantPoolEntry.reset();
57
				constantPoolEntry.setKind(kind);
49
				constantPoolEntry.setClassIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
58
				constantPoolEntry.setClassIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
50
				int declaringClassIndex = u2At(this.classFileBytes,  1, this.constantPoolOffset[constantPoolEntry.getClassIndex()]);
59
				int declaringClassIndex = u2At(this.classFileBytes,  1, this.constantPoolOffset[constantPoolEntry.getClassIndex()]);
51
				constantPoolEntry.setClassName(getUtf8ValueAt(declaringClassIndex));
60
				constantPoolEntry.setClassName(getUtf8ValueAt(declaringClassIndex));
Lines 57-62 public class ConstantPool extends ClassFileStruct implements IConstantPool { Link Here
57
				break;
66
				break;
58
			case IConstantPoolConstant.CONSTANT_Methodref :
67
			case IConstantPoolConstant.CONSTANT_Methodref :
59
			case IConstantPoolConstant.CONSTANT_InterfaceMethodref :
68
			case IConstantPoolConstant.CONSTANT_InterfaceMethodref :
69
				constantPoolEntry = new ConstantPoolEntry();
70
				constantPoolEntry.reset();
71
				constantPoolEntry.setKind(kind);
72
				constantPoolEntry.reset();
73
				constantPoolEntry.setKind(kind);
60
				constantPoolEntry.setClassIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
74
				constantPoolEntry.setClassIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
61
				declaringClassIndex = u2At(this.classFileBytes,  1, this.constantPoolOffset[constantPoolEntry.getClassIndex()]);
75
				declaringClassIndex = u2At(this.classFileBytes,  1, this.constantPoolOffset[constantPoolEntry.getClassIndex()]);
62
				constantPoolEntry.setClassName(getUtf8ValueAt(declaringClassIndex));
76
				constantPoolEntry.setClassName(getUtf8ValueAt(declaringClassIndex));
Lines 67-91 public class ConstantPool extends ClassFileStruct implements IConstantPool { Link Here
67
				constantPoolEntry.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
81
				constantPoolEntry.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
68
				break;
82
				break;
69
			case IConstantPoolConstant.CONSTANT_Float :
83
			case IConstantPoolConstant.CONSTANT_Float :
84
				constantPoolEntry = new ConstantPoolEntry();
85
				constantPoolEntry.reset();
86
				constantPoolEntry.setKind(kind);
87
				constantPoolEntry.reset();
88
				constantPoolEntry.setKind(kind);
70
				constantPoolEntry.setFloatValue(floatAt(this.classFileBytes, 1, this.constantPoolOffset[index]));
89
				constantPoolEntry.setFloatValue(floatAt(this.classFileBytes, 1, this.constantPoolOffset[index]));
71
				break;
90
				break;
72
			case IConstantPoolConstant.CONSTANT_Integer :
91
			case IConstantPoolConstant.CONSTANT_Integer :
92
				constantPoolEntry = new ConstantPoolEntry();
93
				constantPoolEntry.reset();
94
				constantPoolEntry.setKind(kind);
73
				constantPoolEntry.setIntegerValue(i4At(this.classFileBytes, 1, this.constantPoolOffset[index]));
95
				constantPoolEntry.setIntegerValue(i4At(this.classFileBytes, 1, this.constantPoolOffset[index]));
74
				break;
96
				break;
75
			case IConstantPoolConstant.CONSTANT_Long :
97
			case IConstantPoolConstant.CONSTANT_Long :
98
				constantPoolEntry = new ConstantPoolEntry();
99
				constantPoolEntry.reset();
100
				constantPoolEntry.setKind(kind);
76
				constantPoolEntry.setLongValue(i8At(this.classFileBytes, 1, this.constantPoolOffset[index]));
101
				constantPoolEntry.setLongValue(i8At(this.classFileBytes, 1, this.constantPoolOffset[index]));
77
				break;
102
				break;
78
			case IConstantPoolConstant.CONSTANT_NameAndType :
103
			case IConstantPoolConstant.CONSTANT_NameAndType :
104
				constantPoolEntry = new ConstantPoolEntry();
105
				constantPoolEntry.reset();
106
				constantPoolEntry.setKind(kind);
79
				constantPoolEntry.setNameAndTypeNameIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
107
				constantPoolEntry.setNameAndTypeNameIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
80
				constantPoolEntry.setNameAndTypeDescriptorIndex(u2At(this.classFileBytes,  3, this.constantPoolOffset[index]));
108
				constantPoolEntry.setNameAndTypeDescriptorIndex(u2At(this.classFileBytes,  3, this.constantPoolOffset[index]));
81
				break;
109
				break;
82
			case IConstantPoolConstant.CONSTANT_String :
110
			case IConstantPoolConstant.CONSTANT_String :
111
				constantPoolEntry = new ConstantPoolEntry();
112
				constantPoolEntry.reset();
113
				constantPoolEntry.setKind(kind);
83
				constantPoolEntry.setStringIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
114
				constantPoolEntry.setStringIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
84
				constantPoolEntry.setStringValue(getUtf8ValueAt(constantPoolEntry.getStringIndex()));
115
				constantPoolEntry.setStringValue(getUtf8ValueAt(constantPoolEntry.getStringIndex()));
85
				break;
116
				break;
86
			case IConstantPoolConstant.CONSTANT_Utf8 :
117
			case IConstantPoolConstant.CONSTANT_Utf8 :
118
				constantPoolEntry = new ConstantPoolEntry();
119
				constantPoolEntry.reset();
120
				constantPoolEntry.setKind(kind);
87
				constantPoolEntry.setUtf8Length(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
121
				constantPoolEntry.setUtf8Length(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
88
				constantPoolEntry.setUtf8Value(getUtf8ValueAt(index));
122
				constantPoolEntry.setUtf8Value(getUtf8ValueAt(index));
123
				break;
124
			case IConstantPoolConstant.CONSTANT_MethodHandle :
125
				ConstantPoolEntry2 constantPoolEntry2 = new ConstantPoolEntry2();
126
				constantPoolEntry2.reset();
127
				constantPoolEntry2.setKind(kind);
128
				constantPoolEntry2.setReferenceKind(u1At(this.classFileBytes,  1, this.constantPoolOffset[index]));
129
				constantPoolEntry2.setReferenceIndex(u2At(this.classFileBytes,  2, this.constantPoolOffset[index]));
130
				constantPoolEntry = constantPoolEntry2;
131
				break;
132
			case IConstantPoolConstant.CONSTANT_MethodType :
133
				constantPoolEntry2 = new ConstantPoolEntry2();
134
				constantPoolEntry2.reset();
135
				constantPoolEntry2.setKind(kind);
136
				methodDescriptorIndex = u2At(this.classFileBytes,  1, this.constantPoolOffset[index]);
137
				constantPoolEntry2.setDescriptorIndex(methodDescriptorIndex);
138
				constantPoolEntry2.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
139
				constantPoolEntry = constantPoolEntry2;
140
				break;
141
			case IConstantPoolConstant.CONSTANT_InvokeDynamic :
142
				constantPoolEntry2 = new ConstantPoolEntry2();
143
				constantPoolEntry2.reset();
144
				constantPoolEntry2.setKind(kind);
145
				constantPoolEntry2.setBootstrapMethodAttributeIndex(u2At(this.classFileBytes,  1, this.constantPoolOffset[index]));
146
				int nameAndTypeIndex = u2At(this.classFileBytes,  3, this.constantPoolOffset[index]);
147
				constantPoolEntry2.setNameAndTypeIndex(nameAndTypeIndex);
148
				methodNameIndex = u2At(this.classFileBytes,  1, this.constantPoolOffset[nameAndTypeIndex]);
149
				methodDescriptorIndex = u2At(this.classFileBytes,  3, this.constantPoolOffset[nameAndTypeIndex]);
150
				constantPoolEntry2.setMethodName(getUtf8ValueAt(methodNameIndex));
151
				constantPoolEntry2.setMethodDescriptor(getUtf8ValueAt(methodDescriptorIndex));
152
				constantPoolEntry = constantPoolEntry2;
153
				break;
89
		}
154
		}
90
		return constantPoolEntry;
155
		return constantPoolEntry;
91
	}
156
	}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 341-346 public class ConstantPoolEntry implements IConstantPoolEntry { Link Here
341
341
342
	/**
342
	/**
343
	 * Sets the methodDescriptor.
343
	 * Sets the methodDescriptor.
344
	 *
344
	 * @param methodDescriptor The methodDescriptor to set
345
	 * @param methodDescriptor The methodDescriptor to set
345
	 */
346
	 */
346
	public void setMethodDescriptor(char[] methodDescriptor) {
347
	public void setMethodDescriptor(char[] methodDescriptor) {
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry2.java (+66 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.core.util;
12
13
import org.eclipse.jdt.core.util.IConstantPoolEntry2;
14
15
/**
16
 * Default implementation of IConstantPoolEntry
17
 *
18
 * @since 2.0
19
 */
20
public class ConstantPoolEntry2 extends ConstantPoolEntry implements IConstantPoolEntry2 {
21
	
22
	private int descriptorIndex;
23
	private int referenceKind;
24
	private int referenceIndex;
25
	private int bootstrapMethodAttributeIndex;
26
	
27
	public int getDescriptorIndex() {
28
		return this.descriptorIndex;
29
	}
30
31
	public int getReferenceKind() {
32
		return this.referenceKind;
33
	}
34
35
	public int getReferenceIndex() {
36
		return this.referenceIndex;
37
	}
38
39
	public int getBootstrapMethodAttributeIndex() {
40
		return this.bootstrapMethodAttributeIndex;
41
	}
42
43
	public void setDescriptorIndex(int descriptorIndex) {
44
		this.descriptorIndex = descriptorIndex;
45
	}
46
47
	public void setReferenceKind(int referenceKind) {
48
		this.referenceKind = referenceKind;
49
	}
50
51
	public void setReferenceIndex(int referenceIndex) {
52
		this.referenceIndex = referenceIndex;
53
	}
54
55
	public void setBootstrapMethodAttributeIndex(int bootstrapMethodAttributeIndex) {
56
		this.bootstrapMethodAttributeIndex = bootstrapMethodAttributeIndex;
57
	}
58
	
59
	public void reset() {
60
		super.reset();
61
		this.descriptorIndex = 0;
62
		this.referenceKind = 0;
63
		this.referenceIndex = 0;
64
		this.bootstrapMethodAttributeIndex = 0;
65
	}
66
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java (-2 / +27 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 17-22 import org.eclipse.jdt.core.util.IBytecodeVisitor; Link Here
17
import org.eclipse.jdt.core.util.ICodeAttribute;
17
import org.eclipse.jdt.core.util.ICodeAttribute;
18
import org.eclipse.jdt.core.util.IConstantPoolConstant;
18
import org.eclipse.jdt.core.util.IConstantPoolConstant;
19
import org.eclipse.jdt.core.util.IConstantPoolEntry;
19
import org.eclipse.jdt.core.util.IConstantPoolEntry;
20
import org.eclipse.jdt.core.util.IConstantPoolEntry2;
20
import org.eclipse.jdt.core.util.ILocalVariableAttribute;
21
import org.eclipse.jdt.core.util.ILocalVariableAttribute;
21
import org.eclipse.jdt.core.util.ILocalVariableTableEntry;
22
import org.eclipse.jdt.core.util.ILocalVariableTableEntry;
22
import org.eclipse.jdt.core.util.OpcodeStringValues;
23
import org.eclipse.jdt.core.util.OpcodeStringValues;
Lines 1491-1497 public class DefaultBytecodeVisitor implements IBytecodeVisitor { Link Here
1491
		writeNewLine();
1492
		writeNewLine();
1492
	}
1493
	}
1493
	/**
1494
	/**
1494
	 * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry, IConstantPoolEntry)
1495
	 * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)
1495
	 */
1496
	 */
1496
	public void _invokedynamic(
1497
	public void _invokedynamic(
1497
		int pc,
1498
		int pc,
Lines 1513-1518 public class DefaultBytecodeVisitor implements IBytecodeVisitor { Link Here
1513
		writeNewLine();
1514
		writeNewLine();
1514
	}
1515
	}
1515
	/**
1516
	/**
1517
	 * @see IBytecodeVisitor#_invokedynamic(int, int, IConstantPoolEntry)
1518
	 */
1519
	public void _invokedynamic(
1520
		int pc,
1521
		int index,
1522
		IConstantPoolEntry invokeDynamicEntry) {
1523
1524
		dumpPcNumber(pc);
1525
		IConstantPoolEntry2 entry = (IConstantPoolEntry2) invokeDynamicEntry;
1526
		this.buffer.append(Messages.bind(Messages.classformat_invokedynamic,
1527
			new String[] {
1528
				OpcodeStringValues.BYTECODE_NAMES[IOpcodeMnemonics.INVOKEDYNAMIC],
1529
				Integer.toString(index),
1530
				Integer.toString(entry.getBootstrapMethodAttributeIndex()),
1531
				Util.toString(
1532
					null,
1533
					entry.getMethodName(),
1534
					entry.getMethodDescriptor(),
1535
					true,
1536
					isCompact())
1537
			}));
1538
		writeNewLine();
1539
	}
1540
	/**
1516
	 * @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
1541
	 * @see IBytecodeVisitor#_invokeinterface(int, int, byte, IConstantPoolEntry)
1517
	 */
1542
	 */
1518
	public void _invokeinterface(
1543
	public void _invokeinterface(
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java (-23 / +117 lines)
Lines 801-806 public class Disassembler extends ClassFileBytesDisassembler { Link Here
801
		IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
801
		IClassFileAttribute runtimeVisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_VISIBLE_ANNOTATIONS);
802
		IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
802
		IClassFileAttribute runtimeInvisibleAnnotationsAttribute = Util.getAttribute(classFileReader, IAttributeNamesConstants.RUNTIME_INVISIBLE_ANNOTATIONS);
803
803
804
		IClassFileAttribute bootstrapMethods = Util.getAttribute(classFileReader, IAttributeNamesConstants.BOOTSTRAP_METHODS);
805
804
		if (checkMode(mode, DETAILED)) {
806
		if (checkMode(mode, DETAILED)) {
805
			// disassemble compact version of annotations
807
			// disassemble compact version of annotations
806
			if (runtimeInvisibleAnnotationsAttribute != null) {
808
			if (runtimeInvisibleAnnotationsAttribute != null) {
Lines 904-931 public class Disassembler extends ClassFileBytesDisassembler { Link Here
904
			IClassFileAttribute[] attributes = classFileReader.getAttributes();
906
			IClassFileAttribute[] attributes = classFileReader.getAttributes();
905
			int length = attributes.length;
907
			int length = attributes.length;
906
			IEnclosingMethodAttribute enclosingMethodAttribute = getEnclosingMethodAttribute(classFileReader);
908
			IEnclosingMethodAttribute enclosingMethodAttribute = getEnclosingMethodAttribute(classFileReader);
907
			int remainingAttributesLength = length;
908
			if (innerClassesAttribute != null) {
909
				remainingAttributesLength--;
910
			}
911
			if (enclosingMethodAttribute != null) {
912
				remainingAttributesLength--;
913
			}
914
			if (sourceAttribute != null) {
915
				remainingAttributesLength--;
916
			}
917
			if (signatureAttribute != null) {
918
				remainingAttributesLength--;
919
			}
920
			if (innerClassesAttribute != null || enclosingMethodAttribute != null || remainingAttributesLength != 0) {
921
				writeNewLine(buffer, lineSeparator, 0);
922
			}
923
			if (innerClassesAttribute != null) {
909
			if (innerClassesAttribute != null) {
924
				disassemble(innerClassesAttribute, buffer, lineSeparator, 1);
910
				disassemble(innerClassesAttribute, buffer, lineSeparator, 1);
925
			}
911
			}
926
			if (enclosingMethodAttribute != null) {
912
			if (enclosingMethodAttribute != null) {
927
				disassemble(enclosingMethodAttribute, buffer, lineSeparator, 0);
913
				disassemble(enclosingMethodAttribute, buffer, lineSeparator, 0);
928
			}
914
			}
915
			if (bootstrapMethods != null) {
916
				disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0);
917
			}
929
			if (checkMode(mode, SYSTEM)) {
918
			if (checkMode(mode, SYSTEM)) {
930
				if (runtimeVisibleAnnotationsAttribute != null) {
919
				if (runtimeVisibleAnnotationsAttribute != null) {
931
					disassemble((IRuntimeVisibleAnnotationsAttribute) runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
920
					disassemble((IRuntimeVisibleAnnotationsAttribute) runtimeVisibleAnnotationsAttribute, buffer, lineSeparator, 0, mode);
Lines 937-949 public class Disassembler extends ClassFileBytesDisassembler { Link Here
937
					for (int i = 0; i < length; i++) {
926
					for (int i = 0; i < length; i++) {
938
						IClassFileAttribute attribute = attributes[i];
927
						IClassFileAttribute attribute = attributes[i];
939
						if (attribute != innerClassesAttribute
928
						if (attribute != innerClassesAttribute
940
							&& attribute != sourceAttribute
929
								&& attribute != sourceAttribute
941
							&& attribute != signatureAttribute
930
								&& attribute != signatureAttribute
942
							&& attribute != enclosingMethodAttribute
931
								&& attribute != enclosingMethodAttribute
943
							&& attribute != runtimeInvisibleAnnotationsAttribute
932
								&& attribute != runtimeInvisibleAnnotationsAttribute
944
							&& attribute != runtimeVisibleAnnotationsAttribute
933
								&& attribute != runtimeVisibleAnnotationsAttribute
945
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
934
								&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.DEPRECATED)
946
							&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)) {
935
								&& !CharOperation.equals(attribute.getAttributeName(), IAttributeNamesConstants.SYNTHETIC)
936
								&& attribute != bootstrapMethods) {
947
							disassemble(attribute, buffer, lineSeparator, 0, mode);
937
							disassemble(attribute, buffer, lineSeparator, 0, mode);
948
						}
938
						}
949
					}
939
					}
Lines 1408-1416 public class Disassembler extends ClassFileBytesDisassembler { Link Here
1408
								Integer.toString(i),
1398
								Integer.toString(i),
1409
								decodeStringValue(new String(constantPoolEntry.getUtf8Value()))}));
1399
								decodeStringValue(new String(constantPoolEntry.getUtf8Value()))}));
1410
					break;
1400
					break;
1401
				case IConstantPoolConstant.CONSTANT_MethodHandle :
1402
					IConstantPoolEntry2 entry2 = (IConstantPoolEntry2) constantPoolEntry;
1403
					buffer.append(
1404
							Messages.bind(Messages.disassembler_constantpool_methodhandle,
1405
								new String[] {
1406
									Integer.toString(i),
1407
									getReferenceKind(entry2.getReferenceKind()),
1408
									Integer.toString(entry2.getReferenceIndex()),
1409
								}));
1410
					break;
1411
				case IConstantPoolConstant.CONSTANT_MethodType :
1412
					entry2 = (IConstantPoolEntry2) constantPoolEntry;
1413
					buffer.append(
1414
							Messages.bind(Messages.disassembler_constantpool_methodtype,
1415
								new String[] {
1416
									Integer.toString(i),
1417
									Integer.toString(entry2.getDescriptorIndex()),
1418
									String.valueOf(entry2.getMethodDescriptor()),
1419
								}));
1420
					break;
1421
				case IConstantPoolConstant.CONSTANT_InvokeDynamic :
1422
					entry2 = (IConstantPoolEntry2) constantPoolEntry;
1423
					buffer.append(
1424
						Messages.bind(Messages.disassembler_constantpool_invokedynamic,
1425
							new String[] {
1426
								Integer.toString(i),
1427
								Integer.toString(entry2.getBootstrapMethodAttributeIndex()),
1428
								Integer.toString(entry2.getNameAndTypeIndex()),
1429
								new String(constantPoolEntry.getMethodName()),
1430
								new String(constantPoolEntry.getMethodDescriptor())
1431
							}));
1411
			}
1432
			}
1412
		}
1433
		}
1413
	}
1434
	}
1435
	
1436
	private String getReferenceKind(int referenceKind) {
1437
		String message = null;
1438
		switch(referenceKind) {
1439
			case IConstantPoolConstant.METHOD_TYPE_REF_GetField :
1440
				message = Messages.disassembler_method_type_ref_getfield;
1441
				break;
1442
			case IConstantPoolConstant.METHOD_TYPE_REF_GetStatic :
1443
				message = Messages.disassembler_method_type_ref_getstatic;
1444
				break;
1445
			case IConstantPoolConstant.METHOD_TYPE_REF_PutField :
1446
				message = Messages.disassembler_method_type_ref_putfield;
1447
				break;
1448
			case IConstantPoolConstant.METHOD_TYPE_REF_PutStatic :
1449
				message = Messages.disassembler_method_type_ref_putstatic;
1450
				break;
1451
			case IConstantPoolConstant.METHOD_TYPE_REF_InvokeInterface :
1452
				message = Messages.disassembler_method_type_ref_invokeinterface;
1453
				break;
1454
			case IConstantPoolConstant.METHOD_TYPE_REF_InvokeSpecial :
1455
				message = Messages.disassembler_method_type_ref_invokespecial;
1456
				break;
1457
			case IConstantPoolConstant.METHOD_TYPE_REF_InvokeStatic :
1458
				message = Messages.disassembler_method_type_ref_invokestatic;
1459
				break;
1460
			case IConstantPoolConstant.METHOD_TYPE_REF_InvokeVirtual :
1461
				message = Messages.disassembler_method_type_ref_invokevirtual;
1462
				break;
1463
			default :
1464
				message = Messages.disassembler_method_type_ref_newinvokespecial;
1465
		}
1466
		return Messages.bind(message, new String[] { Integer.toString(referenceKind) });
1467
	}
1414
1468
1415
	private void disassemble(IEnclosingMethodAttribute enclosingMethodAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
1469
	private void disassemble(IEnclosingMethodAttribute enclosingMethodAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
1416
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
1470
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
Lines 1669-1674 public class Disassembler extends ClassFileBytesDisassembler { Link Here
1669
		}
1723
		}
1670
	}
1724
	}
1671
1725
1726
	private void disassemble(IBootstrapMethodsAttribute bootstrapMethodsAttribute, StringBuffer buffer, String lineSeparator, int tabNumber) {
1727
		writeNewLine(buffer, lineSeparator, tabNumber);
1728
		buffer.append(Messages.disassembler_bootstrapmethodattributesheader);
1729
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
1730
		IBootstrapMethodsEntry[] entries = bootstrapMethodsAttribute.getBootstrapMethods();
1731
		int length = entries.length;
1732
		for (int i = 0; i < length; i++) {
1733
			if (i != 0) {
1734
				buffer.append(Messages.disassembler_comma);
1735
				writeNewLine(buffer, lineSeparator, tabNumber + 1);
1736
			}
1737
			IBootstrapMethodsEntry entry = entries[i];
1738
			buffer.append(
1739
				Messages.bind(
1740
					Messages.disassembler_bootstrapmethodentry,
1741
					new String[] {
1742
						Integer.toString(i),
1743
						Integer.toString(entry.getBootstrapMethodReference()),
1744
						getArguments(entry.getBootstrapArguments())
1745
					}));
1746
		}
1747
	}
1748
1749
	private String getArguments(int[] arguments) {
1750
		StringBuffer buffer = new StringBuffer();
1751
		buffer.append('{');
1752
		for (int i = 0, max = arguments.length; i < max; i++) {
1753
			if (i != 0) {
1754
				buffer.append(Messages.disassembler_comma);
1755
			}
1756
			buffer.append(
1757
				Messages.bind(
1758
					Messages.disassembler_bootstrapmethodentry_argument,
1759
					new String[] {
1760
						Integer.toString(arguments[i]),
1761
					}));
1762
		}
1763
		buffer.append('}');
1764
		return String.valueOf(buffer);
1765
	}
1672
	private void disassemble(int index, IParameterAnnotation parameterAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
1766
	private void disassemble(int index, IParameterAnnotation parameterAnnotation, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
1673
		IAnnotation[] annotations = parameterAnnotation.getAnnotations();
1767
		IAnnotation[] annotations = parameterAnnotation.getAnnotations();
1674
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
1768
		writeNewLine(buffer, lineSeparator, tabNumber + 1);
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java (+16 lines)
Lines 259-264 public final class Messages extends NLS { Link Here
259
	public static String disassembler_inner_accessflags;
259
	public static String disassembler_inner_accessflags;
260
	public static String disassembler_genericattributeheader;
260
	public static String disassembler_genericattributeheader;
261
	public static String disassembler_signatureattributeheader;
261
	public static String disassembler_signatureattributeheader;
262
	public static String disassembler_bootstrapmethodattributesheader;
263
	public static String disassembler_bootstrapmethodentry;
264
	public static String disassembler_bootstrapmethodentry_argument;
262
	public static String disassembler_indentation;
265
	public static String disassembler_indentation;
263
	public static String disassembler_constantpoolindex;
266
	public static String disassembler_constantpoolindex;
264
	public static String disassembler_space;
267
	public static String disassembler_space;
Lines 278-283 public final class Messages extends NLS { Link Here
278
	public static String disassembler_constantpool_methodref;
281
	public static String disassembler_constantpool_methodref;
279
	public static String disassembler_constantpool_name_and_type;
282
	public static String disassembler_constantpool_name_and_type;
280
	public static String disassembler_constantpool_utf8;
283
	public static String disassembler_constantpool_utf8;
284
	public static String disassembler_constantpool_methodhandle;
285
	public static String disassembler_constantpool_methodtype;
286
	public static String disassembler_constantpool_invokedynamic;
281
	public static String disassembler_annotationdefaultheader;
287
	public static String disassembler_annotationdefaultheader;
282
	public static String disassembler_annotationdefaultvalue;
288
	public static String disassembler_annotationdefaultvalue;
283
	public static String disassembler_annotationenumvalue;
289
	public static String disassembler_annotationenumvalue;
Lines 348-353 public final class Messages extends NLS { Link Here
348
	public static String disassembler_frame_same_frame;
354
	public static String disassembler_frame_same_frame;
349
	public static String disassembler_frame_same_locals_1_stack_item;
355
	public static String disassembler_frame_same_locals_1_stack_item;
350
	public static String code_assist_internal_error;
356
	public static String code_assist_internal_error;
357
	
358
	public static String disassembler_method_type_ref_getfield;
359
	public static String disassembler_method_type_ref_putfield;
360
	public static String disassembler_method_type_ref_getstatic;
361
	public static String disassembler_method_type_ref_putstatic;
362
	public static String disassembler_method_type_ref_invokestatic;
363
	public static String disassembler_method_type_ref_invokevirtual;
364
	public static String disassembler_method_type_ref_invokespecial;
365
	public static String disassembler_method_type_ref_invokeinterface;
366
	public static String disassembler_method_type_ref_newinvokespecial;
351
367
352
	static {
368
	static {
353
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
369
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties (-1 / +16 lines)
Lines 285-290 disassembler_genericattributeheader = Attribute: {0} Length: {1} Link Here
285
disassembler_stackmaptableattributeheader = Stack map table: number of frames {0}
285
disassembler_stackmaptableattributeheader = Stack map table: number of frames {0}
286
disassembler_stackmapattributeheader =  Stack map : number of frames {0}
286
disassembler_stackmapattributeheader =  Stack map : number of frames {0}
287
disassembler_signatureattributeheader = // Signature: {0}
287
disassembler_signatureattributeheader = // Signature: {0}
288
disassembler_bootstrapmethodattributesheader = Bootstrap methods:
289
disassembler_bootstrapmethodentry = {0} : # {1} arguments: {2}
290
disassembler_bootstrapmethodentry_argument = #{0}
288
disassembler_indentation = \  
291
disassembler_indentation = \  
289
disassembler_constantpoolindex =\ #
292
disassembler_constantpoolindex =\ #
290
disassembler_space = \ 
293
disassembler_space = \ 
Lines 304-309 disassembler_constantpool_interfacemethodref = constant #{0} interface_method_re Link Here
304
disassembler_constantpool_methodref = constant #{0} method_ref: #{1}.#{2} {3}.{4} {5}
307
disassembler_constantpool_methodref = constant #{0} method_ref: #{1}.#{2} {3}.{4} {5}
305
disassembler_constantpool_name_and_type = constant #{0} name_and_type: #{1}.#{2} {3} {4}
308
disassembler_constantpool_name_and_type = constant #{0} name_and_type: #{1}.#{2} {3} {4}
306
disassembler_constantpool_utf8 = constant #{0} utf8: "{1}"
309
disassembler_constantpool_utf8 = constant #{0} utf8: "{1}"
310
disassembler_constantpool_methodhandle = constant #{0} method handle: {1} #{2} 
311
disassembler_constantpool_methodtype = constant #{0} method type: #{1} {2}
312
disassembler_constantpool_invokedynamic = constant #{0} invoke dynamic: #{1} #{2} {3} {4}
307
disassembler_annotationdefaultheader = Annotation Default:\ 
313
disassembler_annotationdefaultheader = Annotation Default:\ 
308
disassembler_annotationdefaultvalue= {0} (constant type)
314
disassembler_annotationdefaultvalue= {0} (constant type)
309
disassembler_annotationenumvalue = {2}.{3}(enum type #{0}.#{1})
315
disassembler_annotationenumvalue = {2}.{3}(enum type #{0}.#{1})
Lines 323-328 disassembler_frame_same_locals_1_stack_item_extended=[pc: {0}, same_locals_1_sta Link Here
323
disassembler_frame_chop=[pc: {0}, chop {1} local(s)]
329
disassembler_frame_chop=[pc: {0}, chop {1} local(s)]
324
disassembler_frame_same_frame_extended=[pc: {0}, same_extended]
330
disassembler_frame_same_frame_extended=[pc: {0}, same_extended]
325
disassembler_frame_append=[pc: {0}, append: {1}]
331
disassembler_frame_append=[pc: {0}, append: {1}]
332
disassembler_method_type_ref_getfield = getfield ({0})
333
disassembler_method_type_ref_putfield = putfield ({0})
334
disassembler_method_type_ref_getstatic = getstatic ({0})
335
disassembler_method_type_ref_putstatic = putstatic ({0})
336
disassembler_method_type_ref_invokestatic = invokestatic ({0})
337
disassembler_method_type_ref_invokevirtual = invokevirtual ({0})
338
disassembler_method_type_ref_invokeinterface = invokeinterface ({0})
339
disassembler_method_type_ref_invokespecial = invokespecial ({0})
340
disassembler_method_type_ref_newinvokespecial = newinvokespecial ({0})
326
# {0} = offset delta
341
# {0} = offset delta
327
# {1} = number of locals
342
# {1} = number of locals
328
# {2} = locals
343
# {2} = locals
Lines 358-364 classformat_new = {0} {2} [{1}] Link Here
358
classformat_iinc = {0} {1} {2}{3}
373
classformat_iinc = {0} {1} {2}{3}
359
classformat_invokespecial ={0} {2} [{1}]
374
classformat_invokespecial ={0} {2} [{1}]
360
classformat_invokeinterface ={0} {3} [{1}] [nargs: {2}]
375
classformat_invokeinterface ={0} {3} [{1}] [nargs: {2}]
361
classformat_invokedynamic={0} {2} [{1}]
376
classformat_invokedynamic={0} {2} {3} [{1}]
362
classformat_invokestatic ={0} {2} [{1}]
377
classformat_invokestatic ={0} {2} [{1}]
363
classformat_invokevirtual ={0} {2} [{1}]
378
classformat_invokevirtual ={0} {2} [{1}]
364
classformat_getfield ={0} {2}.{3} : {4} [{1}]
379
classformat_getfield ={0} {2}.{3} : {4} [{1}]

Return to bug 359943