Mercurial > hg > release > icedtea7-forest-2.2 > langtools
changeset 1146:94d8370ebc29
Merge
author | lana |
---|---|
date | Mon, 07 Nov 2011 16:45:00 -0800 |
parents | 945d52ac0e22 (current diff) 5f8938d59243 (diff) |
children | f65eebb8d25f |
files | |
diffstat | 9 files changed, 251 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Fri Nov 04 19:54:16 2011 +0400 +++ b/.hgtags Mon Nov 07 16:45:00 2011 -0800 @@ -121,10 +121,20 @@ 8eb952f43b117d538f6ca5e9e43ff9ce7646c7ee jdk7-b144 c455e2ae5c93014ae3fc475aba4509b5f70465f7 jdk7-b145 9425dd4f53d5bfcd992d9aecea0eb7d8b2d4f62b jdk7-b146 +d34578643d1c6c752d4a6b5e79c6ab1b60850b4a jdk7u1-b01 58bc532d63418ac3c9b42460d89cdaf595c6f3e1 jdk7-b147 +cd2cc8b5edb045b950aed46d159b4fb8fc2fd1df jdk7u1-b02 +82820a30201dbf4b80f1916f3d0f4a92ad21b61a jdk7u1-b03 +baa2c13c70fea3d6e259a34f0903197fdceb64b5 jdk7u1-b04 +7e0f2dcbf41ecbf61475e13ea32436e80f39b513 jdk7u1-b05 ce654f4ecfd8fd5f81618c7e0949f22db08de4d5 jdk7u2-b01 d5d8654d8180dc31a746253e11ac2747292154b4 jdk7u2-b04 1f1c1763ac31e5e1264b0784f48e75cc109e60f4 jdk7u2-b05 4c5514d422c43e23af2437001ae0595d62b6cb19 jdk7u2-b06 0959cd580bf5748a3dfc5c431483d2abef7dd875 jdk7u2-b07 16e34b70cea7fd68ac0aef5f2f56ea6245e4582f jdk7u2-b08 +c91ffd7f2c3fa619d4d2228f16f85a4f5aa13914 jdk7u2-b09 +5935f69f4e558d2bc88c20c55f3de54a457fd26b jdk7u1-b06 +ef15185867cf89e606239f216ff34154ce50563b jdk7u1-b07 +ee94565d9f57ee9885e3af44891877163b637cc3 jdk7u1-b08 +d37897312d318c18b0a855ce80f70c410865d105 jdk7u2-b11
--- a/THIRD_PARTY_README Fri Nov 04 19:54:16 2011 +0400 +++ b/THIRD_PARTY_README Mon Nov 07 16:45:00 2011 -0800 @@ -216,15 +216,16 @@ is included with JRE 7, JDK 7, and OpenJDK 7. You are receiving a copy of the Elliptic Curve Cryptography library in source -form with the JDK 7 source distribution and object code in the JRE 7 & JDK 7 -runtime. - -The terms of the Oracle license do NOT apply to the Elliptic Curve -Cryptography library program; it is licensed under the following license, -separately from the Oracle programs you receive. If you do not wish to install -this program, you may delete the library named libsunec.so (on Solaris and -Linux systems) or sunec.dll (on Windows systems) from the JRE bin directory -reserved for native libraries. +form with the JDK 7 and OpenJDK7 source distributions, and as object code in +the JRE 7 & JDK 7 runtimes. + +In the case of the JRE 7 & JDK 7 runtimes, the terms of the Oracle license do +NOT apply to the Elliptic Curve Cryptography library; it is licensed under the +following license, separately from Oracle's JDK & JRE. If you do not wish to +install the Elliptic Curve Cryptography library, you may delete the library +named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows +systems) from the JRE bin directory reserved for native libraries. + --- begin of LICENSE --- @@ -1000,7 +1001,7 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to libpng 1.2.18, which is +%% This notice is provided with respect to libpng 1.5.4, which is included with JRE 7, JDK 7, and OpenJDK 7. --- begin of LICENSE --- @@ -1014,8 +1015,10 @@ If you modify libpng you may insert additional notices immediately following this sentence. -libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are -Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are +This code is released under the libpng license. + +libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are +Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -1112,7 +1115,7 @@ Glenn Randers-Pehrson glennrp at users.sourceforge.net -May 15, 2007 +July 7, 2011 --- end of LICENSE ---
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Nov 04 19:54:16 2011 +0400 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Nov 07 16:45:00 2011 -0800 @@ -691,6 +691,7 @@ case ABSENT_MTH: return wrongMethod.setWrongSym(sym, ex.getDiagnostic()); case WRONG_MTH: + if (operator) return bestSoFar; wrongMethods.addCandidate(currentStep, wrongMethod.sym, wrongMethod.explanation); case WRONG_MTHS: return wrongMethods.addCandidate(currentStep, sym, ex.getDiagnostic()); @@ -1685,6 +1686,7 @@ */ Symbol resolveOperator(DiagnosticPosition pos, int optag, Env<AttrContext> env, List<Type> argtypes) { + startResolution(); Name name = treeinfo.operatorName(optag); Symbol sym = findMethod(env, syms.predefClass.type, name, argtypes, null, false, false, true);
--- a/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java Fri Nov 04 19:54:16 2011 +0400 +++ b/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java Mon Nov 07 16:45:00 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,6 +98,7 @@ @Override public OutputStream openOutputStream() throws IOException { + fileManager.flushCache(this); ensureParentDirectoriesExist(); return new FileOutputStream(file); } @@ -128,6 +129,7 @@ @Override public Writer openWriter() throws IOException { + fileManager.flushCache(this); ensureParentDirectoriesExist(); return new OutputStreamWriter(new FileOutputStream(file), fileManager.getEncodingName()); }
--- a/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java Fri Nov 04 19:54:16 2011 +0400 +++ b/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java Mon Nov 07 16:45:00 2011 -0800 @@ -205,6 +205,7 @@ @Override public OutputStream openOutputStream() throws IOException { + fileManager.flushCache(this); ensureParentDirectoriesExist(); return Files.newOutputStream(path); } @@ -241,6 +242,7 @@ @Override public Writer openWriter() throws IOException { + fileManager.flushCache(this); ensureParentDirectoriesExist(); return new OutputStreamWriter(Files.newOutputStream(path), fileManager.getEncodingName()); }
--- a/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Fri Nov 04 19:54:16 2011 +0400 +++ b/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Mon Nov 07 16:45:00 2011 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -322,16 +322,46 @@ // <editor-fold defaultstate="collapsed" desc="Content cache"> public CharBuffer getCachedContent(JavaFileObject file) { - SoftReference<CharBuffer> r = contentCache.get(file); - return (r == null ? null : r.get()); + ContentCacheEntry e = contentCache.get(file); + if (e == null) + return null; + + if (!e.isValid(file)) { + contentCache.remove(file); + return null; + } + + return e.getValue(); } public void cache(JavaFileObject file, CharBuffer cb) { - contentCache.put(file, new SoftReference<CharBuffer>(cb)); + contentCache.put(file, new ContentCacheEntry(file, cb)); + } + + public void flushCache(JavaFileObject file) { + contentCache.remove(file); } - protected final Map<JavaFileObject, SoftReference<CharBuffer>> contentCache - = new HashMap<JavaFileObject, SoftReference<CharBuffer>>(); + protected final Map<JavaFileObject, ContentCacheEntry> contentCache + = new HashMap<JavaFileObject, ContentCacheEntry>(); + + protected static class ContentCacheEntry { + final long timestamp; + final SoftReference<CharBuffer> ref; + + ContentCacheEntry(JavaFileObject file, CharBuffer cb) { + this.timestamp = file.getLastModified(); + this.ref = new SoftReference<CharBuffer>(cb); + } + + boolean isValid(JavaFileObject file) { + return timestamp == file.getLastModified(); + } + + CharBuffer getValue() { + return ref.get(); + } + } // </editor-fold> public static Kind getKind(String name) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7102515/T7102515.java Mon Nov 07 16:45:00 2011 -0800 @@ -0,0 +1,11 @@ +/* + * @test /nodynamiccopyright/ + * @bug 7102515 + * @summary javac running very very long and not returning + * @compile/fail/ref=T7102515.out -XDrawDiagnostics T7102515.java + */ + +class T7102515 { + T7102515 badBinary = new T7102515() + new T7102515(); + Object badUnary = badBinary++; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/7102515/T7102515.out Mon Nov 07 16:45:00 2011 -0800 @@ -0,0 +1,3 @@ +T7102515.java:9:41: compiler.err.operator.cant.be.applied.1: +, T7102515, T7102515 +T7102515.java:10:32: compiler.err.operator.cant.be.applied: ++, T7102515, null +2 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/file/T7068451.java Mon Nov 07 16:45:00 2011 -0800 @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7068451 + * @summary Regression: javac compiles fixed sources against previous, + * not current, version of generated sources + */ + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Writer; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.Filer; +import javax.annotation.processing.Messager; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.TypeElement; +import javax.tools.Diagnostic.Kind; +import javax.tools.JavaCompiler; +import javax.tools.JavaCompiler.CompilationTask; +import javax.tools.StandardLocation; +import javax.tools.ToolProvider; + +public class T7068451 { + public static void main(String[] args) throws Exception { + new T7068451().run(); + } + + void run() throws Exception { + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + System.err.println("using " + compiler.getClass() + " from " + compiler.getClass().getProtectionDomain().getCodeSource()); + + File tmp = new File("tmp"); + tmp.mkdir(); + for (File f: tmp.listFiles()) + f.delete(); + + File input = writeFile(tmp, "X.java", "package p; class X { { p.C.first(); } }"); + + List<String> opts = Arrays.asList( + "-s", tmp.getPath(), + "-d", tmp.getPath(), + "-XprintRounds"); + + System.err.println(); + System.err.println("FIRST compilation"); + System.err.println(); + + CompilationTask task = compiler.getTask(null, null, null, opts, null, + compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input)); + task.setProcessors(Collections.singleton(new Proc("first"))); + check("compilation", task.call()); + + writeFile(tmp, "X.java", "package p; class X { { p.C.second(); } }"); + + //Thread.sleep(2000); + + System.err.println(); + System.err.println("SECOND compilation"); + System.err.println(); + + task = compiler.getTask(null, null, null, opts, null, + compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input)); + task.setProcessors(Collections.singleton(new Proc("second"))); + check("compilation", task.call()); + + //Thread.sleep(2000); + + System.err.println(); + System.err.println("SECOND compilation, REPEATED"); + System.err.println(); + + task = compiler.getTask(null, null, null, opts, null, + compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input)); + task.setProcessors(Collections.singleton(new Proc("second"))); + check("compilation", task.call()); + } + + void check(String msg, boolean ok) { + System.err.println(msg + ": " + (ok ? "ok" : "failed")); + if (!ok) + throw new AssertionError(msg); + } + + static File writeFile(File base, String path, String body) throws IOException { + File f = new File(base, path); + FileWriter out = new FileWriter(f); + out.write(body); + out.close(); + System.err.println("wrote " + path + ": " + body); + return f; + } + + @SupportedAnnotationTypes("*") + private static class Proc extends AbstractProcessor { + final String m; + Proc(String m) { + this.m = m; + } + + int count; + @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { + if (roundEnv.processingOver() || count++ > 0) { + return false; + } + + Filer filer = processingEnv.getFiler(); + Messager messager = processingEnv.getMessager(); + + System.err.println("running Proc"); + try { + int len = filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length(); + messager.printMessage(Kind.NOTE, "C.java: found previous content of length " + len); + } catch (FileNotFoundException x) { + messager.printMessage(Kind.NOTE, "C.java: not previously there"); + } catch (IOException x) { + messager.printMessage(Kind.ERROR, "while reading: " + x); + } + + try { + String body = "package p; public class C { public static void " + m + "() {} }"; + Writer w = filer.createSourceFile("p.C").openWriter(); + w.write(body); + w.close(); + messager.printMessage(Kind.NOTE, "C.java: wrote new content: " + body); + } catch (IOException x) { + messager.printMessage(Kind.ERROR, "while writing: " + x); + } + + return true; + } + + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latest(); + } + } +} +