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

changeset 1569
475eb15dfdad
parent 1473
31780dd06ec7
child 1570
f91144b7da75
     1.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Jan 21 00:45:35 2013 -0500
     1.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Jan 21 01:27:42 2013 -0500
     1.3 @@ -134,6 +134,11 @@
     1.4       **/
     1.5      public boolean preferSource;
     1.6  
     1.7 +    /**
     1.8 +     * The currently selected profile.
     1.9 +     */
    1.10 +    public final Profile profile;
    1.11 +
    1.12      /** The log to use for verbose output
    1.13       */
    1.14      final Log log;
    1.15 @@ -284,16 +289,20 @@
    1.16          annotate = Annotate.instance(context);
    1.17          verbose        = options.isSet(VERBOSE);
    1.18          checkClassFile = options.isSet("-checkclassfile");
    1.19 +
    1.20          Source source = Source.instance(context);
    1.21          allowGenerics    = source.allowGenerics();
    1.22          allowVarargs     = source.allowVarargs();
    1.23          allowAnnotations = source.allowAnnotations();
    1.24          allowSimplifiedVarargs = source.allowSimplifiedVarargs();
    1.25          allowDefaultMethods = source.allowDefaultMethods();
    1.26 +
    1.27          saveParameterNames = options.isSet("save-parameter-names");
    1.28          cacheCompletionFailure = options.isUnset("dev");
    1.29          preferSource = "source".equals(options.get("-Xprefer"));
    1.30  
    1.31 +        profile = Profile.instance(context);
    1.32 +
    1.33          completionFailureName =
    1.34              options.isSet("failcomplete")
    1.35              ? names.fromString(options.get("failcomplete"))
    1.36 @@ -1357,7 +1366,18 @@
    1.37                  CompoundAnnotationProxy proxy = readCompoundAnnotation();
    1.38                  if (proxy.type.tsym == syms.proprietaryType.tsym)
    1.39                      sym.flags_field |= PROPRIETARY;
    1.40 -                else
    1.41 +                else if (proxy.type.tsym == syms.profileType.tsym) {
    1.42 +                    if (profile != Profile.DEFAULT) {
    1.43 +                        for (Pair<Name,Attribute> v: proxy.values) {
    1.44 +                            if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
    1.45 +                                Attribute.Constant c = (Attribute.Constant) v.snd;
    1.46 +                                if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
    1.47 +                                    sym.flags_field |= NOT_IN_PROFILE;
    1.48 +                                }
    1.49 +                            }
    1.50 +                        }
    1.51 +                    }
    1.52 +                } else
    1.53                      proxies.append(proxy);
    1.54              }
    1.55              annotate.normal(new AnnotationCompleter(sym, proxies.toList()));

mercurial