< prev index next >

langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java

Print this page




1443         final int  code_length = nextInt();
1444         bp += code_length;
1445         final char exception_table_length = nextChar();
1446         bp += exception_table_length * 8;
1447         readMemberAttrs(owner);
1448         return null;
1449     }
1450 
1451 /************************************************************************
1452  * Reading Java-language annotations
1453  ***********************************************************************/
1454 
1455     /** Attach annotations.
1456      */
1457     void attachAnnotations(final Symbol sym) {
1458         int numAttributes = nextChar();
1459         if (numAttributes != 0) {
1460             ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
1461             for (int i = 0; i<numAttributes; i++) {
1462                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
1463 
1464                 if (proxy.type.tsym == syms.proprietaryType.tsym)
1465                     sym.flags_field |= PROPRIETARY;
1466                 else if (proxy.type.tsym == syms.profileType.tsym) {
1467                     if (profile != Profile.DEFAULT) {
1468                         for (Pair<Name,Attribute> v: proxy.values) {
1469                             if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
1470                                 Attribute.Constant c = (Attribute.Constant) v.snd;
1471                                 if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
1472                                     sym.flags_field |= NOT_IN_PROFILE;
1473                                 }
1474                             }
1475                         }
1476                     }
1477                 } else {
1478                     if (proxy.type.tsym == syms.annotationTargetType.tsym) {
1479                         target = proxy;
1480                     } else if (proxy.type.tsym == syms.repeatableType.tsym) {
1481                         repeatable = proxy;










1482                     }
1483 
1484                     proxies.append(proxy);
1485                 }
1486             }
1487             annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
1488         }
1489     }
1490 
1491     /** Attach parameter annotations.
1492      */
1493     void attachParameterAnnotations(final Symbol method) {
1494         final MethodSymbol meth = (MethodSymbol)method;
1495         int numParameters = buf[bp++] & 0xFF;
1496         List<VarSymbol> parameters = meth.params();
1497         int pnum = 0;
1498         while (parameters.tail != null) {
1499             attachAnnotations(parameters.head);
1500             parameters = parameters.tail;
1501             pnum++;




1443         final int  code_length = nextInt();
1444         bp += code_length;
1445         final char exception_table_length = nextChar();
1446         bp += exception_table_length * 8;
1447         readMemberAttrs(owner);
1448         return null;
1449     }
1450 
1451 /************************************************************************
1452  * Reading Java-language annotations
1453  ***********************************************************************/
1454 
1455     /** Attach annotations.
1456      */
1457     void attachAnnotations(final Symbol sym) {
1458         int numAttributes = nextChar();
1459         if (numAttributes != 0) {
1460             ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
1461             for (int i = 0; i<numAttributes; i++) {
1462                 CompoundAnnotationProxy proxy = readCompoundAnnotation();

1463                 if (proxy.type.tsym == syms.proprietaryType.tsym)
1464                     sym.flags_field |= PROPRIETARY;
1465                 else if (proxy.type.tsym == syms.profileType.tsym) {
1466                     if (profile != Profile.DEFAULT) {
1467                         for (Pair<Name,Attribute> v: proxy.values) {
1468                             if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
1469                                 Attribute.Constant c = (Attribute.Constant) v.snd;
1470                                 if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
1471                                     sym.flags_field |= NOT_IN_PROFILE;
1472                                 }
1473                             }
1474                         }
1475                     }
1476                 } else {
1477                     if (proxy.type.tsym == syms.annotationTargetType.tsym) {
1478                         target = proxy;
1479                     } else if (proxy.type.tsym == syms.repeatableType.tsym) {
1480                         repeatable = proxy;
1481                     } else if (proxy.type.tsym == syms.deprecatedType.tsym) {
1482                         sym.flags_field |= DEPRECATED;
1483                         for (Pair<Name, Attribute> v : proxy.values) {
1484                             if (v.fst == names.forRemoval && v.snd instanceof Attribute.Constant) {
1485                                 Attribute.Constant c = (Attribute.Constant) v.snd;
1486                                 if (c.type == syms.booleanType && ((Integer) c.value) != 0) {
1487                                     sym.flags_field |= DEPRECATED_REMOVAL;
1488                                 }
1489                             }
1490                         }
1491                     }
1492 
1493                     proxies.append(proxy);
1494                 }
1495             }
1496             annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
1497         }
1498     }
1499 
1500     /** Attach parameter annotations.
1501      */
1502     void attachParameterAnnotations(final Symbol method) {
1503         final MethodSymbol meth = (MethodSymbol)method;
1504         int numParameters = buf[bp++] & 0xFF;
1505         List<VarSymbol> parameters = meth.params();
1506         int pnum = 0;
1507         while (parameters.tail != null) {
1508             attachAnnotations(parameters.head);
1509             parameters = parameters.tail;
1510             pnum++;


< prev index next >