Merge

Thu, 30 Jun 2011 14:19:25 -0700

author
lana
date
Thu, 30 Jun 2011 14:19:25 -0700
changeset 1050
469e3bec9b27
parent 1041
e0dec1645823
parent 1049
858ae8fec72f
child 1056
025a370b9fc3
child 1057
2d3096441387
child 1131
34e175c1fabc

Merge

     1.1 --- a/make/build.xml	Mon Jun 27 14:11:09 2011 -0700
     1.2 +++ b/make/build.xml	Thu Jun 30 14:19:25 2011 -0700
     1.3 @@ -336,7 +336,9 @@
     1.4              classpath="${dist.lib.dir}/javac.jar"
     1.5              includeAntRuntime="no"
     1.6              debug="${javac.debug}"
     1.7 -            debuglevel="${javac.debuglevel}"/>
     1.8 +            debuglevel="${javac.debuglevel}">
     1.9 +            <compilerarg line="${javac.lint.opts}"/>
    1.10 +        </javac>
    1.11          <java fork="true"
    1.12              jvm="${target.java.home}/bin/java"
    1.13              dir="test/tools/javac/diags"
    1.14 @@ -857,7 +859,10 @@
    1.15                 srcdir="${make.tools.dir}/CompileProperties"
    1.16                 destdir="${build.toolclasses.dir}/"
    1.17                 classpath="${ant.core.lib}"
    1.18 -               includeantruntime="false"/>
    1.19 +               bootclasspath="${boot.java.home}/jre/lib/rt.jar"
    1.20 +               includeantruntime="false">
    1.21 +            <compilerarg line="${javac.lint.opts}"/>
    1.22 +        </javac>
    1.23          <taskdef name="pcompile"
    1.24                   classname="CompilePropertiesTask"
    1.25                   classpath="${build.toolclasses.dir}/"/>
    1.26 @@ -874,6 +879,7 @@
    1.27                 classpath="${ant.core.lib}"
    1.28                 includeantruntime="false">
    1.29              <compilerarg value="-Xbootclasspath/p:${build.bootstrap.dir}/classes"/>
    1.30 +            <compilerarg line="${javac.lint.opts}"/>
    1.31          </javac>
    1.32          <taskdef name="genstubs"
    1.33                   classname="GenStubs$$Ant"
     2.1 --- a/make/tools/CompileProperties/CompileProperties.java	Mon Jun 27 14:11:09 2011 -0700
     2.2 +++ b/make/tools/CompileProperties/CompileProperties.java	Thu Jun 30 14:19:25 2011 -0700
     2.3 @@ -222,13 +222,13 @@
     2.4                  sortedKeys.add((String)key);
     2.5              }
     2.6              Collections.sort(sortedKeys);
     2.7 -            Iterator keys = sortedKeys.iterator();
     2.8 +            Iterator<String> keys = sortedKeys.iterator();
     2.9  
    2.10              StringBuffer data = new StringBuffer();
    2.11  
    2.12              while (keys.hasNext()) {
    2.13 -                Object key = keys.next();
    2.14 -                data.append("            { \"" + escape((String)key) + "\", \"" +
    2.15 +                String key = keys.next();
    2.16 +                data.append("            { \"" + escape(key) + "\", \"" +
    2.17                          escape((String)p.get(key)) + "\" },\n");
    2.18              }
    2.19  
     3.1 --- a/src/share/classes/com/sun/tools/javac/code/Source.java	Mon Jun 27 14:11:09 2011 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java	Thu Jun 30 14:19:25 2011 -0700
     3.3 @@ -64,8 +64,11 @@
     3.4      /** 1.6 reports encoding problems as errors instead of warnings. */
     3.5      JDK1_6("1.6"),
     3.6  
     3.7 -    /** 1.7 covers the to be determined language features that will be added in JDK 7. */
     3.8 -    JDK1_7("1.7");
     3.9 +    /** 1.7 introduced try-with-resources, multi-catch, string switch, etc. */
    3.10 +    JDK1_7("1.7"),
    3.11 +
    3.12 +    /** 1.8 covers the to be determined language features that will be added in JDK 8. */
    3.13 +    JDK1_8("1.8");
    3.14  
    3.15      private static final Context.Key<Source> sourceKey
    3.16          = new Context.Key<Source>();
    3.17 @@ -92,19 +95,21 @@
    3.18          tab.put("5", JDK1_5); // Make 5 an alias for 1.5
    3.19          tab.put("6", JDK1_6); // Make 6 an alias for 1.6
    3.20          tab.put("7", JDK1_7); // Make 7 an alias for 1.7
    3.21 +        tab.put("8", JDK1_8); // Make 8 an alias for 1.8
    3.22      }
    3.23  
    3.24      private Source(String name) {
    3.25          this.name = name;
    3.26      }
    3.27  
    3.28 -    public static final Source DEFAULT = JDK1_7;
    3.29 +    public static final Source DEFAULT = JDK1_8;
    3.30  
    3.31      public static Source lookup(String name) {
    3.32          return tab.get(name);
    3.33      }
    3.34  
    3.35      public Target requiredTarget() {
    3.36 +        if (this.compareTo(JDK1_8) >= 0) return Target.JDK1_8;
    3.37          if (this.compareTo(JDK1_7) >= 0) return Target.JDK1_7;
    3.38          if (this.compareTo(JDK1_6) >= 0) return Target.JDK1_6;
    3.39          if (this.compareTo(JDK1_5) >= 0) return Target.JDK1_5;
    3.40 @@ -203,6 +208,8 @@
    3.41              return RELEASE_6;
    3.42          case JDK1_7:
    3.43              return RELEASE_7;
    3.44 +        case JDK1_8:
    3.45 +            return RELEASE_8;
    3.46          default:
    3.47              return null;
    3.48          }
     4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Jun 27 14:11:09 2011 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 30 14:19:25 2011 -0700
     4.3 @@ -3388,6 +3388,13 @@
     4.4          }
     4.5  
     4.6          @Override
     4.7 +        public void visitAssignop(JCAssignOp that) {
     4.8 +            if (that.operator == null)
     4.9 +                that.operator = new OperatorSymbol(names.empty, syms.unknownType, -1, syms.noSymbol);
    4.10 +            super.visitAssignop(that);
    4.11 +        }
    4.12 +
    4.13 +        @Override
    4.14          public void visitBinary(JCBinary that) {
    4.15              if (that.operator == null)
    4.16                  that.operator = new OperatorSymbol(names.empty, syms.unknownType, -1, syms.noSymbol);
     5.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Target.java	Mon Jun 27 14:11:09 2011 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Target.java	Thu Jun 30 14:19:25 2011 -0700
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
     5.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8   *
     5.9   * This code is free software; you can redistribute it and/or modify it
    5.10 @@ -66,7 +66,10 @@
    5.11      JDK1_6("1.6", 50, 0),
    5.12  
    5.13      /** JDK 7. */
    5.14 -    JDK1_7("1.7", 51, 0);
    5.15 +    JDK1_7("1.7", 51, 0),
    5.16 +
    5.17 +    /** JDK 8. */ // For now, a clone of 7
    5.18 +    JDK1_8("1.8", 51, 0);
    5.19  
    5.20      private static final Context.Key<Target> targetKey =
    5.21          new Context.Key<Target>();
    5.22 @@ -99,6 +102,7 @@
    5.23          tab.put("5", JDK1_5);
    5.24          tab.put("6", JDK1_6);
    5.25          tab.put("7", JDK1_7);
    5.26 +        tab.put("8", JDK1_8);
    5.27      }
    5.28  
    5.29      public final String name;
    5.30 @@ -110,7 +114,7 @@
    5.31          this.minorVersion = minorVersion;
    5.32      }
    5.33  
    5.34 -    public static final Target DEFAULT = JDK1_7;
    5.35 +    public static final Target DEFAULT = JDK1_8;
    5.36  
    5.37      public static Target lookup(String name) {
    5.38          return tab.get(name);
     6.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Jun 27 14:11:09 2011 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Jun 30 14:19:25 2011 -0700
     6.3 @@ -295,59 +295,24 @@
     6.4  
     6.5      /**
     6.6       * Use a service loader appropriate for the platform to provide an
     6.7 -     * iterator over annotations processors.  If
     6.8 -     * java.util.ServiceLoader is present use it, otherwise, use
     6.9 -     * sun.misc.Service, otherwise fail if a loader is needed.
    6.10 +     * iterator over annotations processors; fails if a loader is
    6.11 +     * needed but unavailable.
    6.12       */
    6.13      private class ServiceIterator implements Iterator<Processor> {
    6.14 -        // The to-be-wrapped iterator.
    6.15 -        private Iterator<?> iterator;
    6.16 +        private Iterator<Processor> iterator;
    6.17          private Log log;
    6.18 -        private Class<?> loaderClass;
    6.19 -        private boolean jusl;
    6.20 -        private Object loader;
    6.21 +        private ServiceLoader<Processor> loader;
    6.22  
    6.23          ServiceIterator(ClassLoader classLoader, Log log) {
    6.24 -            String loadMethodName;
    6.25 -
    6.26              this.log = log;
    6.27              try {
    6.28                  try {
    6.29 -                    loaderClass = Class.forName("java.util.ServiceLoader");
    6.30 -                    loadMethodName = "load";
    6.31 -                    jusl = true;
    6.32 -                } catch (ClassNotFoundException cnfe) {
    6.33 -                    try {
    6.34 -                        loaderClass = Class.forName("sun.misc.Service");
    6.35 -                        loadMethodName = "providers";
    6.36 -                        jusl = false;
    6.37 -                    } catch (ClassNotFoundException cnfe2) {
    6.38 -                        // Fail softly if a loader is not actually needed.
    6.39 -                        this.iterator = handleServiceLoaderUnavailability("proc.no.service",
    6.40 -                                                                          null);
    6.41 -                        return;
    6.42 -                    }
    6.43 +                    loader = ServiceLoader.load(Processor.class, classLoader);
    6.44 +                    this.iterator = loader.iterator();
    6.45 +                } catch (Exception e) {
    6.46 +                    // Fail softly if a loader is not actually needed.
    6.47 +                    this.iterator = handleServiceLoaderUnavailability("proc.no.service", null);
    6.48                  }
    6.49 -
    6.50 -                // java.util.ServiceLoader.load or sun.misc.Service.providers
    6.51 -                Method loadMethod = loaderClass.getMethod(loadMethodName,
    6.52 -                                                          Class.class,
    6.53 -                                                          ClassLoader.class);
    6.54 -
    6.55 -                Object result = loadMethod.invoke(null,
    6.56 -                                                  Processor.class,
    6.57 -                                                  classLoader);
    6.58 -
    6.59 -                // For java.util.ServiceLoader, we have to call another
    6.60 -                // method to get the iterator.
    6.61 -                if (jusl) {
    6.62 -                    loader = result; // Store ServiceLoader to call reload later
    6.63 -                    Method m = loaderClass.getMethod("iterator");
    6.64 -                    result = m.invoke(result); // serviceLoader.iterator();
    6.65 -                }
    6.66 -
    6.67 -                // The result should now be an iterator.
    6.68 -                this.iterator = (Iterator<?>) result;
    6.69              } catch (Throwable t) {
    6.70                  log.error("proc.service.problem");
    6.71                  throw new Abort(t);
    6.72 @@ -357,25 +322,21 @@
    6.73          public boolean hasNext() {
    6.74              try {
    6.75                  return iterator.hasNext();
    6.76 +            } catch(ServiceConfigurationError sce) {
    6.77 +                log.error("proc.bad.config.file", sce.getLocalizedMessage());
    6.78 +                throw new Abort(sce);
    6.79              } catch (Throwable t) {
    6.80 -                if ("ServiceConfigurationError".
    6.81 -                    equals(t.getClass().getSimpleName())) {
    6.82 -                    log.error("proc.bad.config.file", t.getLocalizedMessage());
    6.83 -                }
    6.84                  throw new Abort(t);
    6.85              }
    6.86          }
    6.87  
    6.88          public Processor next() {
    6.89              try {
    6.90 -                return (Processor)(iterator.next());
    6.91 +                return iterator.next();
    6.92 +            } catch (ServiceConfigurationError sce) {
    6.93 +                log.error("proc.bad.config.file", sce.getLocalizedMessage());
    6.94 +                throw new Abort(sce);
    6.95              } catch (Throwable t) {
    6.96 -                if ("ServiceConfigurationError".
    6.97 -                    equals(t.getClass().getSimpleName())) {
    6.98 -                    log.error("proc.bad.config.file", t.getLocalizedMessage());
    6.99 -                } else {
   6.100 -                    log.error("proc.processor.constructor.error", t.getLocalizedMessage());
   6.101 -                }
   6.102                  throw new Abort(t);
   6.103              }
   6.104          }
   6.105 @@ -385,11 +346,9 @@
   6.106          }
   6.107  
   6.108          public void close() {
   6.109 -            if (jusl) {
   6.110 +            if (loader != null) {
   6.111                  try {
   6.112 -                    // Call java.util.ServiceLoader.reload
   6.113 -                    Method reloadMethod = loaderClass.getMethod("reload");
   6.114 -                    reloadMethod.invoke(loader);
   6.115 +                    loader.reload();
   6.116                  } catch(Exception e) {
   6.117                      ; // Ignore problems during a call to reload.
   6.118                  }
   6.119 @@ -1516,6 +1475,14 @@
   6.120          return context;
   6.121      }
   6.122  
   6.123 +    /**
   6.124 +     * Internal use method to return the writer being used by the
   6.125 +     * processing environment.
   6.126 +     */
   6.127 +    public PrintWriter getWriter() {
   6.128 +        return context.get(Log.outKey);
   6.129 +    }
   6.130 +
   6.131      public String toString() {
   6.132          return "javac ProcessingEnvironment";
   6.133      }
     7.1 --- a/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Mon Jun 27 14:11:09 2011 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java	Thu Jun 30 14:19:25 2011 -0700
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -48,8 +48,7 @@
    7.11   * deletion without notice.</b>
    7.12   */
    7.13  @SupportedAnnotationTypes("*")
    7.14 -// TODO: Change to version 7 based visitors when available
    7.15 -@SupportedSourceVersion(SourceVersion.RELEASE_7)
    7.16 +@SupportedSourceVersion(SourceVersion.RELEASE_8)
    7.17  public class PrintingProcessor extends AbstractProcessor {
    7.18      PrintWriter writer;
    7.19  
     8.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Jun 27 14:11:09 2011 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Jun 30 14:19:25 2011 -0700
     8.3 @@ -637,8 +637,7 @@
     8.4      Class names, ''{0}'', are only accepted if annotation processing is explicitly requested
     8.5  
     8.6  compiler.err.proc.no.service=\
     8.7 -    A service loader class could not be found.\n\
     8.8 -    Either java.util.ServiceLoader or sun.misc.Service must be available.
     8.9 +    A ServiceLoader was not usable and is required for annotation processing.
    8.10  
    8.11  compiler.err.proc.processor.bad.option.name=\
    8.12      Bad option name ''{0}'' provided by processor ''{1}''
    8.13 @@ -647,9 +646,6 @@
    8.14  compiler.err.proc.processor.cant.instantiate=\
    8.15      Could not instantiate an instance of processor ''{0}''
    8.16  
    8.17 -compiler.err.proc.processor.constructor.error=\
    8.18 -    Exception thrown while constructing Processor object: {0}
    8.19 -
    8.20  # 0: string
    8.21  compiler.err.proc.processor.not.found=\
    8.22      Annotation processor ''{0}'' not found
     9.1 --- a/src/share/classes/javax/lang/model/SourceVersion.java	Mon Jun 27 14:11:09 2011 -0700
     9.2 +++ b/src/share/classes/javax/lang/model/SourceVersion.java	Thu Jun 30 14:19:25 2011 -0700
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -124,7 +124,15 @@
    9.11       *
    9.12       * @since 1.7
    9.13       */
    9.14 -    RELEASE_7;
    9.15 +    RELEASE_7,
    9.16 +
    9.17 +    /**
    9.18 +     * The version recognized by the Java Platform, Standard Edition
    9.19 +     * 8.
    9.20 +     *
    9.21 +     * @since 1.8
    9.22 +     */
    9.23 +    RELEASE_8;
    9.24  
    9.25      // Note that when adding constants for newer releases, the
    9.26      // behavior of latest() and latestSupported() must be updated too.
    9.27 @@ -135,7 +143,7 @@
    9.28       * @return the latest source version that can be modeled
    9.29       */
    9.30      public static SourceVersion latest() {
    9.31 -        return RELEASE_7;
    9.32 +        return RELEASE_8;
    9.33      }
    9.34  
    9.35      private static final SourceVersion latestSupported = getLatestSupported();
    9.36 @@ -143,9 +151,12 @@
    9.37      private static SourceVersion getLatestSupported() {
    9.38          try {
    9.39              String specVersion = System.getProperty("java.specification.version");
    9.40 -            if ("1.7".equals(specVersion))
    9.41 +
    9.42 +            if ("1.8".equals(specVersion))
    9.43 +                return RELEASE_8;
    9.44 +            else if("1.7".equals(specVersion))
    9.45                  return RELEASE_7;
    9.46 -            else if ("1.6".equals(specVersion))
    9.47 +            else if("1.6".equals(specVersion))
    9.48                  return RELEASE_6;
    9.49          } catch (SecurityException se) {}
    9.50  
    10.1 --- a/test/tools/javac/6330997/T6330997.java	Mon Jun 27 14:11:09 2011 -0700
    10.2 +++ b/test/tools/javac/6330997/T6330997.java	Thu Jun 30 14:19:25 2011 -0700
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -23,12 +23,12 @@
   10.11  
   10.12  /**
   10.13   * @test
   10.14 - * @bug     6330997
   10.15 + * @bug     6330997 7025789
   10.16   * @summary javac should accept class files with major version of the next release
   10.17   * @author  Wei Tao
   10.18   * @clean T1 T2
   10.19 - * @compile -target 7 T1.java
   10.20 - * @compile -target 7 T2.java
   10.21 + * @compile -target 8 T1.java
   10.22 + * @compile -target 8 T2.java
   10.23   * @run main/othervm T6330997
   10.24   */
   10.25  
    11.1 --- a/test/tools/javac/api/T6395981.java	Mon Jun 27 14:11:09 2011 -0700
    11.2 +++ b/test/tools/javac/api/T6395981.java	Thu Jun 30 14:19:25 2011 -0700
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 2006, 2011 Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -23,13 +23,13 @@
   11.11  
   11.12  /*
   11.13   * @test
   11.14 - * @bug     6395981 6458819
   11.15 + * @bug     6395981 6458819 7025784
   11.16   * @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
   11.17   * @author  Peter von der Ah\u00e9
   11.18   * @run main/fail T6395981
   11.19   * @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
   11.20   * @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
   11.21 - * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7
   11.22 + * @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8
   11.23   */
   11.24  
   11.25  import java.util.EnumSet;
    12.1 --- a/test/tools/javac/diags/examples.not-yet.txt	Mon Jun 27 14:11:09 2011 -0700
    12.2 +++ b/test/tools/javac/diags/examples.not-yet.txt	Thu Jun 30 14:19:25 2011 -0700
    12.3 @@ -31,7 +31,6 @@
    12.4  compiler.err.proc.cant.create.loader                    # security exception from service loader
    12.5  compiler.err.proc.no.service                            # JavacProcessingEnvironment: no service loader available
    12.6  compiler.err.proc.processor.bad.option.name             # cannot happen? masked by javac.err.invalid.A.key
    12.7 -compiler.err.proc.processor.constructor.error
    12.8  compiler.err.proc.service.problem                       # JavacProcessingEnvironment: catch Throwable from service loader
    12.9  compiler.err.signature.doesnt.match.intf                # UNUSED
   12.10  compiler.err.signature.doesnt.match.supertype           # UNUSED
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/tools/javac/failover/FailOver15.java	Thu Jun 30 14:19:25 2011 -0700
    13.3 @@ -0,0 +1,19 @@
    13.4 +/*
    13.5 + * @test /nodynamiccopyright/
    13.6 + * @bug 6970584 7060926
    13.7 + * @summary Attr.PostAttrAnalyzer misses a case
    13.8 + *
    13.9 + * @compile/fail/ref=FailOver15.out -XDrawDiagnostics -XDshouldStopPolicy=FLOW -XDdev FailOver15.java
   13.10 + */
   13.11 +
   13.12 +class Test {
   13.13 +    void m() {
   13.14 +        new UnknownClass<String, Void>() {
   13.15 +            public String getString() {
   13.16 +                String s = "";
   13.17 +                s += "more";
   13.18 +                return s;
   13.19 +            }
   13.20 +        }
   13.21 +    }
   13.22 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/tools/javac/failover/FailOver15.out	Thu Jun 30 14:19:25 2011 -0700
    14.3 @@ -0,0 +1,4 @@
    14.4 +FailOver15.java:17:10: compiler.err.expected: ';'
    14.5 +FailOver15.java:11:13: compiler.err.cant.resolve.location: kindname.class, UnknownClass, , , (compiler.misc.location: kindname.class, Test, null)
    14.6 +2 errors
    14.7 +
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/tools/javac/processing/model/TestSourceVersion.java	Thu Jun 30 14:19:25 2011 -0700
    15.3 @@ -0,0 +1,45 @@
    15.4 +/*
    15.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 + *
    15.8 + * This code is free software; you can redistribute it and/or modify it
    15.9 + * under the terms of the GNU General Public License version 2 only, as
   15.10 + * published by the Free Software Foundation.
   15.11 + *
   15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 + * version 2 for more details (a copy is included in the LICENSE file that
   15.16 + * accompanied this code).
   15.17 + *
   15.18 + * You should have received a copy of the GNU General Public License version
   15.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 + *
   15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.23 + * or visit www.oracle.com if you need additional information or have any
   15.24 + * questions.
   15.25 + */
   15.26 +
   15.27 +/*
   15.28 + * @test
   15.29 + * @bug 7025809
   15.30 + * @summary Test latest and latestSupported
   15.31 + * @author  Joseph D. Darcy
   15.32 + */
   15.33 +
   15.34 +import javax.lang.model.SourceVersion;
   15.35 +import static javax.lang.model.SourceVersion.*;
   15.36 +
   15.37 +/**
   15.38 + * Verify latest[Supported] behavior.
   15.39 + */
   15.40 +public class TestSourceVersion {
   15.41 +    public static void main(String... args) {
   15.42 +        if (SourceVersion.latest() != RELEASE_8 ||
   15.43 +            SourceVersion.latestSupported() != RELEASE_8)
   15.44 +            throw new RuntimeException("Unexpected release value(s) found:\n" +
   15.45 +                                       "latest:\t" + SourceVersion.latest() + "\n" +
   15.46 +                                       "latestSupported:\t" + SourceVersion.latestSupported());
   15.47 +    }
   15.48 +}
    16.1 --- a/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Mon Jun 27 14:11:09 2011 -0700
    16.2 +++ b/test/tools/javac/processing/warnings/TestSourceVersionWarnings.java	Thu Jun 30 14:19:25 2011 -0700
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -23,7 +23,7 @@
   16.11  
   16.12  /*
   16.13   * @test
   16.14 - * @bug 6376083 6376084 6458819
   16.15 + * @bug 6376083 6376084 6458819 7025784 7025786 7025789
   16.16   * @summary Test that warnings about source versions are output as expected.
   16.17   * @author  Joseph D. Darcy
   16.18   * @compile TestSourceVersionWarnings.java
   16.19 @@ -35,7 +35,8 @@
   16.20   * @compile/ref=gold_sv_warn_5_6.out   -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_5 -source 1.6 -Xlint:-options HelloWorld.java
   16.21   * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options HelloWorld.java
   16.22   * @compile/ref=gold_unsp_warn.out     -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java
   16.23 - * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7                 HelloWorld.java
   16.24 + * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 -Xlint:-options HelloWorld.java
   16.25 + * @compile/ref=gold_sv_none.out       -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8 -source 1.8                 HelloWorld.java
   16.26   */
   16.27  
   16.28  import java.util.Set;
   16.29 @@ -51,7 +52,8 @@
   16.30  /**
   16.31   * This processor returns the supported source level as indicated by
   16.32   * the "SourceLevel" option; therefore, don't use
   16.33 - * JavacTestingAbstractProcessor which returns the latest source level.
   16.34 + * JavacTestingAbstractProcessor which returns the latest source
   16.35 + * level.
   16.36   */
   16.37  @SupportedAnnotationTypes("*")
   16.38  @SupportedOptions("SourceVersion")
    17.1 --- a/test/tools/javac/quid/T6999438.java	Mon Jun 27 14:11:09 2011 -0700
    17.2 +++ b/test/tools/javac/quid/T6999438.java	Thu Jun 30 14:19:25 2011 -0700
    17.3 @@ -1,7 +1,7 @@
    17.4  /* @test /nodynamiccopyright/
    17.5   * @bug 6999438
    17.6   * @summary remove support for exotic identifiers from JDK 7
    17.7 - * @compile/fail/ref=T6999438.out -XDrawDiagnostics -source 7 T6999438.java
    17.8 + * @compile/fail/ref=T6999438.out -XDrawDiagnostics T6999438.java
    17.9   */
   17.10  
   17.11  class Test {
    18.1 --- a/test/tools/javac/util/T6597678.java	Mon Jun 27 14:11:09 2011 -0700
    18.2 +++ b/test/tools/javac/util/T6597678.java	Thu Jun 30 14:19:25 2011 -0700
    18.3 @@ -23,7 +23,7 @@
    18.4  
    18.5  /**
    18.6   * @test
    18.7 - * @bug 6597678
    18.8 + * @bug 6597678 6449184
    18.9   * @summary Ensure Messages propogated between rounds
   18.10   * @library ../lib
   18.11   * @build JavacTestingAbstractProcessor T6597678
   18.12 @@ -42,26 +42,28 @@
   18.13  import com.sun.tools.javac.util.Context;
   18.14  import com.sun.tools.javac.util.JavacMessages;
   18.15  
   18.16 +@SupportedOptions("WriterString")
   18.17  public class T6597678 extends JavacTestingAbstractProcessor {
   18.18      public static void main(String... args) throws Exception {
   18.19          new T6597678().run();
   18.20      }
   18.21  
   18.22 -
   18.23      void run() throws Exception {
   18.24          String myName = T6597678.class.getSimpleName();
   18.25          File testSrc = new File(System.getProperty("test.src"));
   18.26          File file = new File(testSrc, myName + ".java");
   18.27  
   18.28 -        compile(
   18.29 +        StringWriter sw = new StringWriter();
   18.30 +        PrintWriter pw = new PrintWriter(sw);
   18.31 +
   18.32 +        compile(sw, pw,
   18.33              "-proc:only",
   18.34              "-processor", myName,
   18.35 +            "-AWriterString=" + pw.toString(),
   18.36              file.getPath());
   18.37      }
   18.38  
   18.39 -    void compile(String... args) throws Exception {
   18.40 -        StringWriter sw = new StringWriter();
   18.41 -        PrintWriter pw = new PrintWriter(sw);
   18.42 +    void compile(StringWriter sw, PrintWriter pw, String... args) throws Exception {
   18.43          int rc = com.sun.tools.javac.Main.compile(args, pw);
   18.44          pw.close();
   18.45          String out = sw.toString();
   18.46 @@ -76,6 +78,7 @@
   18.47      @Override
   18.48      public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
   18.49          Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
   18.50 +        PrintWriter out = ((JavacProcessingEnvironment) processingEnv).getWriter();
   18.51          Locale locale = context.get(Locale.class);
   18.52          JavacMessages messages = context.get(JavacMessages.messagesKey);
   18.53  
   18.54 @@ -83,9 +86,13 @@
   18.55          if (round == 1) {
   18.56              initialLocale = locale;
   18.57              initialMessages = messages;
   18.58 +            initialWriter = out;
   18.59 +
   18.60 +            checkEqual("writerString", out.toString().intern(), options.get("WriterString").intern());
   18.61          } else {
   18.62              checkEqual("locale", locale, initialLocale);
   18.63              checkEqual("messages", messages, initialMessages);
   18.64 +            checkEqual("writer", out, initialWriter);
   18.65          }
   18.66  
   18.67          return true;
   18.68 @@ -102,4 +109,5 @@
   18.69      int round = 0;
   18.70      Locale initialLocale;
   18.71      JavacMessages initialMessages;
   18.72 +    PrintWriter initialWriter;
   18.73  }
    19.1 --- a/test/tools/javac/versions/check.sh	Mon Jun 27 14:11:09 2011 -0700
    19.2 +++ b/test/tools/javac/versions/check.sh	Thu Jun 30 14:19:25 2011 -0700
    19.3 @@ -22,7 +22,7 @@
    19.4  #
    19.5  
    19.6  # @test
    19.7 -# @bug 4981566 5028634 5094412 6304984
    19.8 +# @bug 4981566 5028634 5094412 6304984 7025786 7025789
    19.9  # @summary Check interpretation of -target and -source options
   19.10  # @build CheckClassFileVersion
   19.11  # @run shell check.sh 
   19.12 @@ -65,9 +65,14 @@
   19.13  check 51.0 -source 6
   19.14  check 51.0 -source 1.7
   19.15  check 51.0 -source 7
   19.16 -check 51.0 -target 1.7
   19.17 -check 51.0 -target 7
   19.18 +check 51.0 -source 7 -target 1.7
   19.19 +check 51.0 -source 7 -target 7
   19.20  
   19.21 +# Update when class file version is revved
   19.22 +check 51.0 -source 1.8
   19.23 +check 51.0 -source 8
   19.24 +check 51.0 -target 1.8
   19.25 +check 51.0 -target 8
   19.26  
   19.27  # Check source versions
   19.28  
   19.29 @@ -96,6 +101,7 @@
   19.30  checksrc15() { pass $* $TC/X.java; pass $* $TC/Y.java; }
   19.31  checksrc16() { checksrc15 $* ; }
   19.32  checksrc17() { checksrc15 $* ; }
   19.33 +checksrc18() { checksrc15 $* ; }
   19.34  
   19.35  checksrc14 -source 1.4
   19.36  checksrc14 -source 1.4 -target 1.5
   19.37 @@ -108,16 +114,24 @@
   19.38  checksrc16 -source 1.6 -target 1.6
   19.39  checksrc16 -source 6 -target 6
   19.40  
   19.41 -checksrc17
   19.42 -checksrc17 -target 1.7
   19.43 -checksrc17 -target 7
   19.44  checksrc17 -source 1.7
   19.45  checksrc17 -source 7
   19.46  checksrc17 -source 1.7 -target 1.7
   19.47  checksrc17 -source 7 -target 7
   19.48  
   19.49 +checksrc18
   19.50 +checksrc18 -target 1.8
   19.51 +checksrc18 -target 8
   19.52 +checksrc18 -source 1.8
   19.53 +checksrc18 -source 8
   19.54 +checksrc18 -source 1.8 -target 1.8
   19.55 +checksrc18 -source 8 -target 8
   19.56 +
   19.57  fail -source 1.5 -target 1.4 $TC/X.java
   19.58  fail -source 1.6 -target 1.4 $TC/X.java
   19.59  fail -source 6   -target 1.4 $TC/X.java
   19.60  fail -source 1.6 -target 1.5 $TC/X.java
   19.61  fail -source 6   -target 1.5 $TC/X.java
   19.62 +fail -source 7   -target 1.6 $TC/X.java
   19.63 +fail -source 8   -target 1.6 $TC/X.java
   19.64 +fail -source 8   -target 1.7 $TC/X.java

mercurial