langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
equal
deleted
inserted
replaced
541 ? Type.noType |
541 ? Type.noType |
542 : findTypeVar(names.fromUtf(signature, start, sigp - 1 - start)); |
542 : findTypeVar(names.fromUtf(signature, start, sigp - 1 - start)); |
543 case '+': { |
543 case '+': { |
544 sigp++; |
544 sigp++; |
545 Type t = sigToType(); |
545 Type t = sigToType(); |
546 return new WildcardType(t, BoundKind.EXTENDS, syms.boundClass, |
546 return new WildcardType(t, BoundKind.EXTENDS, syms.boundClass); |
547 Type.noAnnotations); |
|
548 } |
547 } |
549 case '*': |
548 case '*': |
550 sigp++; |
549 sigp++; |
551 return new WildcardType(syms.objectType, BoundKind.UNBOUND, |
550 return new WildcardType(syms.objectType, BoundKind.UNBOUND, |
552 syms.boundClass, Type.noAnnotations); |
551 syms.boundClass); |
553 case '-': { |
552 case '-': { |
554 sigp++; |
553 sigp++; |
555 Type t = sigToType(); |
554 Type t = sigToType(); |
556 return new WildcardType(t, BoundKind.SUPER, syms.boundClass, |
555 return new WildcardType(t, BoundKind.SUPER, syms.boundClass); |
557 Type.noAnnotations); |
|
558 } |
556 } |
559 case 'B': |
557 case 'B': |
560 sigp++; |
558 sigp++; |
561 return syms.byteType; |
559 return syms.byteType; |
562 case 'C': |
560 case 'C': |
597 case 'Z': |
595 case 'Z': |
598 sigp++; |
596 sigp++; |
599 return syms.booleanType; |
597 return syms.booleanType; |
600 case '[': |
598 case '[': |
601 sigp++; |
599 sigp++; |
602 return new ArrayType(sigToType(), syms.arrayClass, |
600 return new ArrayType(sigToType(), syms.arrayClass); |
603 Type.noAnnotations); |
|
604 case '(': |
601 case '(': |
605 sigp++; |
602 sigp++; |
606 List<Type> argtypes = sigToTypes(')'); |
603 List<Type> argtypes = sigToTypes(')'); |
607 Type restype = sigToType(); |
604 Type restype = sigToType(); |
608 List<Type> thrown = List.nil(); |
605 List<Type> thrown = List.nil(); |
653 sbp - startSbp)); |
650 sbp - startSbp)); |
654 |
651 |
655 try { |
652 try { |
656 return (outer == Type.noType) ? |
653 return (outer == Type.noType) ? |
657 t.erasure(types) : |
654 t.erasure(types) : |
658 new ClassType(outer, List.<Type>nil(), t, |
655 new ClassType(outer, List.<Type>nil(), t); |
659 Type.noAnnotations); |
|
660 } finally { |
656 } finally { |
661 sbp = startSbp; |
657 sbp = startSbp; |
662 } |
658 } |
663 } |
659 } |
664 |
660 |
665 case '<': // generic arguments |
661 case '<': // generic arguments |
666 ClassSymbol t = syms.enterClass(names.fromUtf(signatureBuffer, |
662 ClassSymbol t = syms.enterClass(names.fromUtf(signatureBuffer, |
667 startSbp, |
663 startSbp, |
668 sbp - startSbp)); |
664 sbp - startSbp)); |
669 outer = new ClassType(outer, sigToTypes('>'), t, |
665 outer = new ClassType(outer, sigToTypes('>'), t) { |
670 Type.noAnnotations) { |
|
671 boolean completed = false; |
666 boolean completed = false; |
672 @Override @DefinedBy(Api.LANGUAGE_MODEL) |
667 @Override @DefinedBy(Api.LANGUAGE_MODEL) |
673 public Type getEnclosingType() { |
668 public Type getEnclosingType() { |
674 if (!completed) { |
669 if (!completed) { |
675 completed = true; |
670 completed = true; |
728 //we have seen an enclosing non-generic class |
723 //we have seen an enclosing non-generic class |
729 if (outer != Type.noType) { |
724 if (outer != Type.noType) { |
730 t = syms.enterClass(names.fromUtf(signatureBuffer, |
725 t = syms.enterClass(names.fromUtf(signatureBuffer, |
731 startSbp, |
726 startSbp, |
732 sbp - startSbp)); |
727 sbp - startSbp)); |
733 outer = new ClassType(outer, List.<Type>nil(), t, |
728 outer = new ClassType(outer, List.<Type>nil(), t); |
734 Type.noAnnotations); |
|
735 } |
729 } |
736 signatureBuffer[sbp++] = (byte)'$'; |
730 signatureBuffer[sbp++] = (byte)'$'; |
737 continue; |
731 continue; |
738 case '/': |
732 case '/': |
739 signatureBuffer[sbp++] = (byte)'.'; |
733 signatureBuffer[sbp++] = (byte)'.'; |
792 int start = sigp; |
786 int start = sigp; |
793 while (signature[sigp] != ':') sigp++; |
787 while (signature[sigp] != ':') sigp++; |
794 Name name = names.fromUtf(signature, start, sigp - start); |
788 Name name = names.fromUtf(signature, start, sigp - start); |
795 TypeVar tvar; |
789 TypeVar tvar; |
796 if (sigEnterPhase) { |
790 if (sigEnterPhase) { |
797 tvar = new TypeVar(name, currentOwner, syms.botType, |
791 tvar = new TypeVar(name, currentOwner, syms.botType); |
798 Type.noAnnotations); |
|
799 typevars.enter(tvar.tsym); |
792 typevars.enter(tvar.tsym); |
800 } else { |
793 } else { |
801 tvar = (TypeVar)findTypeVar(name); |
794 tvar = (TypeVar)findTypeVar(name); |
802 } |
795 } |
803 List<Type> bounds = List.nil(); |
796 List<Type> bounds = List.nil(); |
832 // currentOwner.owner.type.getTypeArguments() |
825 // currentOwner.owner.type.getTypeArguments() |
833 // However, until we have read the enclosing method attribute |
826 // However, until we have read the enclosing method attribute |
834 // we don't know for sure if this owner is correct. It could |
827 // we don't know for sure if this owner is correct. It could |
835 // be a method and there is no way to tell before reading the |
828 // be a method and there is no way to tell before reading the |
836 // enclosing method attribute. |
829 // enclosing method attribute. |
837 TypeVar t = new TypeVar(name, currentOwner, syms.botType, |
830 TypeVar t = new TypeVar(name, currentOwner, syms.botType); |
838 Type.noAnnotations); |
|
839 missingTypeVariables = missingTypeVariables.prepend(t); |
831 missingTypeVariables = missingTypeVariables.prepend(t); |
840 // System.err.println("Missing type var " + name); |
832 // System.err.println("Missing type var " + name); |
841 return t; |
833 return t; |
842 } |
834 } |
843 throw badClassFile("undecl.type.var", name); |
835 throw badClassFile("undecl.type.var", name); |