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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java (+1 lines)
Lines 30-33 Link Here
30
	final char[] RuntimeVisibleParameterAnnotationsName = "RuntimeVisibleParameterAnnotations".toCharArray(); //$NON-NLS-1$
30
	final char[] RuntimeVisibleParameterAnnotationsName = "RuntimeVisibleParameterAnnotations".toCharArray(); //$NON-NLS-1$
31
	final char[] StackMapTableName = "StackMapTable".toCharArray(); //$NON-NLS-1$
31
	final char[] StackMapTableName = "StackMapTable".toCharArray(); //$NON-NLS-1$
32
	final char[] InconsistentHierarchy = "InconsistentHierarchy".toCharArray(); //$NON-NLS-1$
32
	final char[] InconsistentHierarchy = "InconsistentHierarchy".toCharArray(); //$NON-NLS-1$
33
	final char[] VarargsName = "Varargs".toCharArray(); //$NON-NLS-1$
33
}
34
}
(-)model/org/eclipse/jdt/internal/core/util/Disassembler.java (-5 / +12 lines)
Lines 17-22 Link Here
17
import org.eclipse.jdt.core.Signature;
17
import org.eclipse.jdt.core.Signature;
18
import org.eclipse.jdt.core.compiler.CharOperation;
18
import org.eclipse.jdt.core.compiler.CharOperation;
19
import org.eclipse.jdt.core.util.*;
19
import org.eclipse.jdt.core.util.*;
20
import org.eclipse.jdt.internal.compiler.codegen.AttributeNamesConstants;
20
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
21
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
21
22
22
/**
23
/**
Lines 560-566 Link Here
560
			buffer.append(Messages.disassembler_space); 
561
			buffer.append(Messages.disassembler_space); 
561
		}
562
		}
562
		CharOperation.replace(methodDescriptor, '/', '.');
563
		CharOperation.replace(methodDescriptor, '/', '.');
563
		final boolean isVarArgs = (accessFlags & IModifierConstants.ACC_VARARGS) != 0;
564
		final boolean isVarArgs = isVarArgs(methodInfo);
564
		if (methodInfo.isConstructor()) {
565
		if (methodInfo.isConstructor()) {
565
			if (checkMode(mode, WORKING_COPY) && signatureAttribute != null) {
566
			if (checkMode(mode, WORKING_COPY) && signatureAttribute != null) {
566
				final char[] signature = signatureAttribute.getSignature();
567
				final char[] signature = signatureAttribute.getSignature();
Lines 619-625 Link Here
619
				if (returnType.length == 1) {
620
				if (returnType.length == 1) {
620
					switch(returnType[0]) {
621
					switch(returnType[0]) {
621
						case 'V' :
622
						case 'V' :
622
							writeNewLine(buffer, lineSeparator, tabNumber);							
623
							writeNewLine(buffer, lineSeparator, tabNumber);
623
							break;
624
							break;
624
						case 'I' :
625
						case 'I' :
625
						case 'B' :
626
						case 'B' :
Lines 630-648 Link Here
630
						case 'C' :
631
						case 'C' :
631
							writeNewLine(buffer, lineSeparator, tabNumber + 1);
632
							writeNewLine(buffer, lineSeparator, tabNumber + 1);
632
							buffer.append("return 0;"); //$NON-NLS-1$
633
							buffer.append("return 0;"); //$NON-NLS-1$
633
							writeNewLine(buffer, lineSeparator, tabNumber);							
634
							writeNewLine(buffer, lineSeparator, tabNumber);
634
							break;
635
							break;
635
						default :
636
						default :
636
							// boolean
637
							// boolean
637
							writeNewLine(buffer, lineSeparator, tabNumber + 1);
638
							writeNewLine(buffer, lineSeparator, tabNumber + 1);
638
							buffer.append("return false;"); //$NON-NLS-1$
639
							buffer.append("return false;"); //$NON-NLS-1$
639
							writeNewLine(buffer, lineSeparator, tabNumber);							
640
							writeNewLine(buffer, lineSeparator, tabNumber);
640
					}
641
					}
641
				} else {
642
				} else {
642
					// object
643
					// object
643
					writeNewLine(buffer, lineSeparator, tabNumber + 1);
644
					writeNewLine(buffer, lineSeparator, tabNumber + 1);
644
					buffer.append("return null;"); //$NON-NLS-1$
645
					buffer.append("return null;"); //$NON-NLS-1$
645
					writeNewLine(buffer, lineSeparator, tabNumber);							
646
					writeNewLine(buffer, lineSeparator, tabNumber);
646
				}
647
				}
647
				buffer.append('}');
648
				buffer.append('}');
648
			} else {
649
			} else {
Lines 980-985 Link Here
980
		return CharOperation.equals(TypeConstants.JAVA_LANG_OBJECT, CharOperation.splitOn('.', className));
981
		return CharOperation.equals(TypeConstants.JAVA_LANG_OBJECT, CharOperation.splitOn('.', className));
981
	}
982
	}
982
	
983
	
984
	private boolean isVarArgs(IMethodInfo methodInfo) {
985
		int accessFlags = methodInfo.getAccessFlags();
986
		if ((accessFlags & IModifierConstants.ACC_VARARGS) != 0) return true;
987
		// check the presence of the unspecified Varargs attribute
988
		return Util.getAttribute(methodInfo, AttributeNamesConstants.VarargsName) != null;
989
	}
983
	private void disassemble(ICodeAttribute codeAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
990
	private void disassemble(ICodeAttribute codeAttribute, StringBuffer buffer, String lineSeparator, int tabNumber, int mode) {
984
		writeNewLine(buffer, lineSeparator, tabNumber - 1);
991
		writeNewLine(buffer, lineSeparator, tabNumber - 1);
985
		DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, buffer, lineSeparator, tabNumber, mode);
992
		DefaultBytecodeVisitor visitor = new DefaultBytecodeVisitor(codeAttribute, buffer, lineSeparator, tabNumber, mode);
(-)compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java (+3 lines)
Lines 369-374 Link Here
369
					if (CharOperation.equals(attributeName, AttributeNamesConstants.AnnotationDefaultName))
369
					if (CharOperation.equals(attributeName, AttributeNamesConstants.AnnotationDefaultName))
370
						this.accessFlags |= ClassFileConstants.AccAnnotationDefault;
370
						this.accessFlags |= ClassFileConstants.AccAnnotationDefault;
371
					break;
371
					break;
372
				case 'V' :
373
					if (CharOperation.equals(attributeName, AttributeNamesConstants.VarargsName))
374
						this.accessFlags |= ClassFileConstants.AccVarargs;
372
			}
375
			}
373
		}
376
		}
374
		readOffset += (6 + u4At(readOffset + 2));
377
		readOffset += (6 + u4At(readOffset + 2));
(-)compiler/org/eclipse/jdt/internal/compiler/ClassFile.java (-19 / +43 lines)
Lines 5347-5369 Link Here
5347
5347
5348
			attributeNumber++;
5348
			attributeNumber++;
5349
		}
5349
		}
5350
		if (this.targetJDK < ClassFileConstants.JDK1_5 && methodBinding.isSynthetic()) {
5350
		if (this.targetJDK < ClassFileConstants.JDK1_5) {
5351
			// Synthetic attribute
5351
			if (methodBinding.isSynthetic()) {
5352
			// Check that there is enough space to write the deprecated attribute
5352
				// Synthetic attribute
5353
			if (contentsOffset + 6 >= this.contents.length) {
5353
				// Check that there is enough space to write the deprecated attribute
5354
				resizeContents(6);
5354
				if (contentsOffset + 6 >= this.contents.length) {
5355
			}
5355
					resizeContents(6);
5356
			int syntheticAttributeNameIndex =
5356
				}
5357
				constantPool.literalIndex(AttributeNamesConstants.SyntheticName);
5357
				int syntheticAttributeNameIndex =
5358
			contents[contentsOffset++] = (byte) (syntheticAttributeNameIndex >> 8);
5358
					constantPool.literalIndex(AttributeNamesConstants.SyntheticName);
5359
			contents[contentsOffset++] = (byte) syntheticAttributeNameIndex;
5359
				contents[contentsOffset++] = (byte) (syntheticAttributeNameIndex >> 8);
5360
			// the length of a synthetic attribute is equals to 0
5360
				contents[contentsOffset++] = (byte) syntheticAttributeNameIndex;
5361
			contents[contentsOffset++] = 0;
5361
				// the length of a synthetic attribute is equals to 0
5362
			contents[contentsOffset++] = 0;
5362
				contents[contentsOffset++] = 0;
5363
			contents[contentsOffset++] = 0;
5363
				contents[contentsOffset++] = 0;
5364
			contents[contentsOffset++] = 0;
5364
				contents[contentsOffset++] = 0;
5365
5365
				contents[contentsOffset++] = 0;
5366
			attributeNumber++;
5366
	
5367
				attributeNumber++;
5368
			}
5369
			if (methodBinding.isVarargs()) {
5370
				/*
5371
				 * handle of the target jsr14 for varargs in the source
5372
				 * Varargs attribute
5373
				 * Check that there is enough space to write the deprecated attribute
5374
				 */
5375
				if (contentsOffset + 6 >= this.contents.length) {
5376
					resizeContents(6);
5377
				}
5378
				int varargsAttributeNameIndex =
5379
					constantPool.literalIndex(AttributeNamesConstants.VarargsName);
5380
				contents[contentsOffset++] = (byte) (varargsAttributeNameIndex >> 8);
5381
				contents[contentsOffset++] = (byte) varargsAttributeNameIndex;
5382
				// the length of a varargs attribute is equals to 0
5383
				contents[contentsOffset++] = 0;
5384
				contents[contentsOffset++] = 0;
5385
				contents[contentsOffset++] = 0;
5386
				contents[contentsOffset++] = 0;
5387
	
5388
				attributeNumber++;
5389
			}
5367
		}
5390
		}
5368
		// add signature attribute
5391
		// add signature attribute
5369
		char[] genericSignature = methodBinding.genericSignature();
5392
		char[] genericSignature = methodBinding.genericSignature();
Lines 5439-5446 Link Here
5439
			resizeContents(10);
5462
			resizeContents(10);
5440
		}
5463
		}
5441
		if (targetJDK < ClassFileConstants.JDK1_5) {
5464
		if (targetJDK < ClassFileConstants.JDK1_5) {
5442
		    // pre 1.5, synthetic was an attribute, not a modifier
5465
			// pre 1.5, synthetic is an attribute, not a modifier
5443
		    accessFlags &= ~ClassFileConstants.AccSynthetic;
5466
			// pre 1.5, varargs is an attribute, not a modifier (-target jsr14 mode)
5467
			accessFlags &= ~(ClassFileConstants.AccSynthetic | ClassFileConstants.AccVarargs);
5444
		}
5468
		}
5445
		if ((methodBinding.tagBits & TagBits.ClearPrivateModifier) != 0) {
5469
		if ((methodBinding.tagBits & TagBits.ClearPrivateModifier) != 0) {
5446
			accessFlags &= ~ClassFileConstants.AccPrivate;
5470
			accessFlags &= ~ClassFileConstants.AccPrivate;

Return to bug 186181