Merge
This commit is contained in:
commit
52da428ead
@ -87,7 +87,7 @@ public class Bark extends Log {
|
|||||||
context.put(barkKey, this);
|
context.put(barkKey, this);
|
||||||
|
|
||||||
// register additional resource bundle for APT messages.
|
// register additional resource bundle for APT messages.
|
||||||
Messages aptMessages = new Messages(Messages.getDefaultBundle());
|
Messages aptMessages = Messages.instance(context);
|
||||||
aptMessages.add("com.sun.tools.apt.resources.apt");
|
aptMessages.add("com.sun.tools.apt.resources.apt");
|
||||||
aptDiags = new JCDiagnostic.Factory(aptMessages, "apt");
|
aptDiags = new JCDiagnostic.Factory(aptMessages, "apt");
|
||||||
|
|
||||||
|
@ -923,14 +923,7 @@ public abstract class Symbol implements Element {
|
|||||||
public Object call() {
|
public Object call() {
|
||||||
JavaFileObject source = log.useSource(env.toplevel.sourcefile);
|
JavaFileObject source = log.useSource(env.toplevel.sourcefile);
|
||||||
try {
|
try {
|
||||||
// In order to catch self-references, we set
|
|
||||||
// the variable's declaration position to
|
|
||||||
// maximal possible value, effectively marking
|
|
||||||
// the variable as undefined.
|
|
||||||
int pos = VarSymbol.this.pos;
|
|
||||||
VarSymbol.this.pos = Position.MAXPOS;
|
|
||||||
Type itype = attr.attribExpr(initializer, env, type);
|
Type itype = attr.attribExpr(initializer, env, type);
|
||||||
VarSymbol.this.pos = pos;
|
|
||||||
if (itype.constValue() != null)
|
if (itype.constValue() != null)
|
||||||
return attr.coerce(itype, type).constValue();
|
return attr.coerce(itype, type).constValue();
|
||||||
else
|
else
|
||||||
|
@ -305,6 +305,11 @@ public class Types {
|
|||||||
else if (t.tag == TYPEVAR) {
|
else if (t.tag == TYPEVAR) {
|
||||||
return isSubtypeUnchecked(t.getUpperBound(), s, warn);
|
return isSubtypeUnchecked(t.getUpperBound(), s, warn);
|
||||||
}
|
}
|
||||||
|
else if (s.tag == UNDETVAR) {
|
||||||
|
UndetVar uv = (UndetVar)s;
|
||||||
|
if (uv.inst != null)
|
||||||
|
return isSubtypeUnchecked(t, uv.inst, warn);
|
||||||
|
}
|
||||||
else if (!s.isRaw()) {
|
else if (!s.isRaw()) {
|
||||||
Type t2 = asSuper(t, s.tsym);
|
Type t2 = asSuper(t, s.tsym);
|
||||||
if (t2 != null && t2.isRaw()) {
|
if (t2 != null && t2.isRaw()) {
|
||||||
|
@ -730,9 +730,8 @@ public class Attr extends JCTree.Visitor {
|
|||||||
// In order to catch self-references, we set the variable's
|
// In order to catch self-references, we set the variable's
|
||||||
// declaration position to maximal possible value, effectively
|
// declaration position to maximal possible value, effectively
|
||||||
// marking the variable as undefined.
|
// marking the variable as undefined.
|
||||||
v.pos = Position.MAXPOS;
|
initEnv.info.enclVar = v;
|
||||||
attribExpr(tree.init, initEnv, v.type);
|
attribExpr(tree.init, initEnv, v.type);
|
||||||
v.pos = tree.pos;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = tree.type = v.type;
|
result = tree.type = v.type;
|
||||||
@ -2198,18 +2197,19 @@ public class Attr extends JCTree.Visitor {
|
|||||||
// This check applies only to class and instance
|
// This check applies only to class and instance
|
||||||
// variables. Local variables follow different scope rules,
|
// variables. Local variables follow different scope rules,
|
||||||
// and are subject to definite assignment checking.
|
// and are subject to definite assignment checking.
|
||||||
if (v.pos > tree.pos &&
|
if ((env.info.enclVar == v || v.pos > tree.pos) &&
|
||||||
v.owner.kind == TYP &&
|
v.owner.kind == TYP &&
|
||||||
canOwnInitializer(env.info.scope.owner) &&
|
canOwnInitializer(env.info.scope.owner) &&
|
||||||
v.owner == env.info.scope.owner.enclClass() &&
|
v.owner == env.info.scope.owner.enclClass() &&
|
||||||
((v.flags() & STATIC) != 0) == Resolve.isStatic(env) &&
|
((v.flags() & STATIC) != 0) == Resolve.isStatic(env) &&
|
||||||
(env.tree.getTag() != JCTree.ASSIGN ||
|
(env.tree.getTag() != JCTree.ASSIGN ||
|
||||||
TreeInfo.skipParens(((JCAssign) env.tree).lhs) != tree)) {
|
TreeInfo.skipParens(((JCAssign) env.tree).lhs) != tree)) {
|
||||||
|
String suffix = (env.info.enclVar == v) ?
|
||||||
|
"self.ref" : "forward.ref";
|
||||||
if (!onlyWarning || isStaticEnumField(v)) {
|
if (!onlyWarning || isStaticEnumField(v)) {
|
||||||
log.error(tree.pos(), "illegal.forward.ref");
|
log.error(tree.pos(), "illegal." + suffix);
|
||||||
} else if (useBeforeDeclarationWarning) {
|
} else if (useBeforeDeclarationWarning) {
|
||||||
log.warning(tree.pos(), "forward.ref", v);
|
log.warning(tree.pos(), suffix, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,11 @@ public class AttrContext {
|
|||||||
*/
|
*/
|
||||||
Lint lint;
|
Lint lint;
|
||||||
|
|
||||||
|
/** The variable whose initializer is being attributed
|
||||||
|
* useful for detecting self-references in variable initializers
|
||||||
|
*/
|
||||||
|
Symbol enclVar = null;
|
||||||
|
|
||||||
/** Duplicate this context, replacing scope field and copying all others.
|
/** Duplicate this context, replacing scope field and copying all others.
|
||||||
*/
|
*/
|
||||||
AttrContext dup(Scope scope) {
|
AttrContext dup(Scope scope) {
|
||||||
@ -77,6 +82,7 @@ public class AttrContext {
|
|||||||
info.varArgs = varArgs;
|
info.varArgs = varArgs;
|
||||||
info.tvars = tvars;
|
info.tvars = tvars;
|
||||||
info.lint = lint;
|
info.lint = lint;
|
||||||
|
info.enclVar = enclVar;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,8 +627,11 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
|||||||
tree.sym = v;
|
tree.sym = v;
|
||||||
if (tree.init != null) {
|
if (tree.init != null) {
|
||||||
v.flags_field |= HASINIT;
|
v.flags_field |= HASINIT;
|
||||||
if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS)
|
if ((v.flags_field & FINAL) != 0 && tree.init.getTag() != JCTree.NEWCLASS) {
|
||||||
v.setLazyConstValue(initEnv(tree, env), log, attr, tree.init);
|
Env<AttrContext> initEnv = getInitEnv(tree, env);
|
||||||
|
initEnv.info.enclVar = v;
|
||||||
|
v.setLazyConstValue(initEnv(tree, initEnv), log, attr, tree.init);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (chk.checkUnique(tree.pos(), v, enclScope)) {
|
if (chk.checkUnique(tree.pos(), v, enclScope)) {
|
||||||
chk.checkTransparentVar(tree.pos(), v, enclScope);
|
chk.checkTransparentVar(tree.pos(), v, enclScope);
|
||||||
@ -828,6 +831,9 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
|||||||
// Save class environment for later member enter (2) processing.
|
// Save class environment for later member enter (2) processing.
|
||||||
halfcompleted.append(env);
|
halfcompleted.append(env);
|
||||||
|
|
||||||
|
// Mark class as not yet attributed.
|
||||||
|
c.flags_field |= UNATTRIBUTED;
|
||||||
|
|
||||||
// If this is a toplevel-class, make sure any preceding import
|
// If this is a toplevel-class, make sure any preceding import
|
||||||
// clauses have been seen.
|
// clauses have been seen.
|
||||||
if (c.owner.kind == PCK) {
|
if (c.owner.kind == PCK) {
|
||||||
@ -835,9 +841,6 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
|
|||||||
todo.append(env);
|
todo.append(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark class as not yet attributed.
|
|
||||||
c.flags_field |= UNATTRIBUTED;
|
|
||||||
|
|
||||||
if (c.owner.kind == TYP)
|
if (c.owner.kind == TYP)
|
||||||
c.owner.complete();
|
c.owner.complete();
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ package com.sun.tools.javac.main;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
@ -1185,14 +1186,16 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
|||||||
* are processed through attribute and flow before subtypes are translated.
|
* are processed through attribute and flow before subtypes are translated.
|
||||||
*/
|
*/
|
||||||
class ScanNested extends TreeScanner {
|
class ScanNested extends TreeScanner {
|
||||||
Set<Env<AttrContext>> dependencies = new HashSet<Env<AttrContext>>();
|
Set<Env<AttrContext>> dependencies = new LinkedHashSet<Env<AttrContext>>();
|
||||||
public void visitClassDef(JCClassDecl node) {
|
public void visitClassDef(JCClassDecl node) {
|
||||||
Type st = types.supertype(node.sym.type);
|
Type st = types.supertype(node.sym.type);
|
||||||
if (st.tag == TypeTags.CLASS) {
|
if (st.tag == TypeTags.CLASS) {
|
||||||
ClassSymbol c = st.tsym.outermostClass();
|
ClassSymbol c = st.tsym.outermostClass();
|
||||||
Env<AttrContext> stEnv = enter.getEnv(c);
|
Env<AttrContext> stEnv = enter.getEnv(c);
|
||||||
if (stEnv != null && env != stEnv)
|
if (stEnv != null && env != stEnv) {
|
||||||
dependencies.add(stEnv);
|
if (dependencies.add(stEnv))
|
||||||
|
scan(stEnv.tree);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.visitClassDef(node);
|
super.visitClassDef(node);
|
||||||
}
|
}
|
||||||
@ -1204,6 +1207,11 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
|
|||||||
flow(attribute(dep));
|
flow(attribute(dep));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//We need to check for error another time as more classes might
|
||||||
|
//have been attributed and analyzed at this stage
|
||||||
|
if (errorCount() > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (verboseCompilePolicy)
|
if (verboseCompilePolicy)
|
||||||
log.printLines(log.noticeWriter, "[desugar " + env.enclClass.sym + "]");
|
log.printLines(log.noticeWriter, "[desugar " + env.enclClass.sym + "]");
|
||||||
|
|
||||||
|
@ -200,6 +200,10 @@ compiler.err.illegal.forward.ref=\
|
|||||||
illegal forward reference
|
illegal forward reference
|
||||||
compiler.warn.forward.ref=\
|
compiler.warn.forward.ref=\
|
||||||
reference to variable ''{0}'' before it has been initialized
|
reference to variable ''{0}'' before it has been initialized
|
||||||
|
compiler.err.illegal.self.ref=\
|
||||||
|
self-reference in initializer
|
||||||
|
compiler.warn.self.ref=\
|
||||||
|
self-reference in initializer of variable ''{0}''
|
||||||
compiler.err.illegal.generic.type.for.instof=\
|
compiler.err.illegal.generic.type.for.instof=\
|
||||||
illegal generic type for instanceof
|
illegal generic type for instanceof
|
||||||
compiler.err.illegal.initializer.for.type=\
|
compiler.err.illegal.initializer.for.type=\
|
||||||
|
39
langtools/test/tools/javac/6734819/T6734819a.java
Normal file
39
langtools/test/tools/javac/6734819/T6734819a.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6734819
|
||||||
|
* @summary Javac performs flows analysis on already translated classes
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
*
|
||||||
|
* @compile/ref=T6734819a.out -XDrawDiagnostics -Xlint:all -XDverboseCompilePolicy T6734819a.java
|
||||||
|
*/
|
||||||
|
class Y extends W {}
|
||||||
|
class W extends Z {}
|
||||||
|
|
||||||
|
class Z {
|
||||||
|
void m(Z z) {
|
||||||
|
W w = (W)z;
|
||||||
|
}
|
||||||
|
}
|
12
langtools/test/tools/javac/6734819/T6734819a.out
Normal file
12
langtools/test/tools/javac/6734819/T6734819a.out
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[attribute Y]
|
||||||
|
[flow Y]
|
||||||
|
[attribute W]
|
||||||
|
[flow W]
|
||||||
|
[attribute Z]
|
||||||
|
[flow Z]
|
||||||
|
[desugar Y]
|
||||||
|
[generate code Y]
|
||||||
|
[desugar W]
|
||||||
|
[generate code W]
|
||||||
|
[desugar Z]
|
||||||
|
[generate code Z]
|
35
langtools/test/tools/javac/6734819/T6734819b.java
Normal file
35
langtools/test/tools/javac/6734819/T6734819b.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6734819
|
||||||
|
* @summary Javac performs flows analysis on already translated classes
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
*
|
||||||
|
* @compile/ref=T6734819b.out -XDrawDiagnostics -Xlint:all -XDverboseCompilePolicy T6734819b.java
|
||||||
|
*/
|
||||||
|
class A extends B {}
|
||||||
|
class B {
|
||||||
|
class C extends B {}
|
||||||
|
}
|
9
langtools/test/tools/javac/6734819/T6734819b.out
Normal file
9
langtools/test/tools/javac/6734819/T6734819b.out
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[attribute A]
|
||||||
|
[flow A]
|
||||||
|
[attribute B]
|
||||||
|
[flow B]
|
||||||
|
[desugar A]
|
||||||
|
[generate code A]
|
||||||
|
[desugar B]
|
||||||
|
[generate code B]
|
||||||
|
[generate code B]
|
40
langtools/test/tools/javac/6734819/T6734819c.java
Normal file
40
langtools/test/tools/javac/6734819/T6734819c.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6734819
|
||||||
|
* @summary Javac performs flows analysis on already translated classes
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
*
|
||||||
|
* @compile/fail/ref=T6734819c.out -XDrawDiagnostics -Xlint:all -XDverboseCompilePolicy T6734819c.java
|
||||||
|
*/
|
||||||
|
class Y extends W {}
|
||||||
|
class W extends Z {}
|
||||||
|
|
||||||
|
class Z {
|
||||||
|
void m(Z z) {
|
||||||
|
return;
|
||||||
|
W w = (W)z;
|
||||||
|
}
|
||||||
|
}
|
8
langtools/test/tools/javac/6734819/T6734819c.out
Normal file
8
langtools/test/tools/javac/6734819/T6734819c.out
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[attribute Y]
|
||||||
|
[flow Y]
|
||||||
|
[attribute W]
|
||||||
|
[flow W]
|
||||||
|
[attribute Z]
|
||||||
|
[flow Z]
|
||||||
|
T6734819c.java:38:11: compiler.err.unreachable.stmt
|
||||||
|
1 error
|
36
langtools/test/tools/javac/ForwardReference/T6676362a.java
Normal file
36
langtools/test/tools/javac/ForwardReference/T6676362a.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6676362
|
||||||
|
* @summary Spurious forward reference error with final var + instance variable initializer
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
*
|
||||||
|
* @compile T6676362a.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class T6676362a {
|
||||||
|
Object o = new Object() {Object m() {return o2;}};
|
||||||
|
final Object o2 = o;
|
||||||
|
}
|
36
langtools/test/tools/javac/ForwardReference/T6676362b.java
Normal file
36
langtools/test/tools/javac/ForwardReference/T6676362b.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6676362
|
||||||
|
* @summary Spurious forward reference error with final var + instance variable initializer
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
*
|
||||||
|
* @compile T6676362b.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class T6676362b {
|
||||||
|
static final int i1 = T6676362b.i2; //legal - usage is not via simple name
|
||||||
|
static final int i2 = i1;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
T6425594.java:10:28: compiler.warn.forward.ref: x
|
T6425594.java:10:28: compiler.warn.self.ref: x
|
||||||
T6425594.java:11:26: compiler.err.illegal.forward.ref
|
T6425594.java:11:26: compiler.err.illegal.forward.ref
|
||||||
1 error
|
1 error
|
||||||
1 warning
|
1 warning
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6718364
|
||||||
|
* @summary inference fails when a generic method is invoked with raw arguments
|
||||||
|
* @compile/ref=T6718364.out -XDstdout -XDrawDiagnostics -Xlint:unchecked T6718364.java
|
||||||
|
*/
|
||||||
|
class T6718364 {
|
||||||
|
class X<T> {}
|
||||||
|
|
||||||
|
public <T> void m(X<T> x, T t) {}
|
||||||
|
|
||||||
|
public void test() {
|
||||||
|
m(new X<X<Integer>>(), new X());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
|
||||||
|
T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: <T>m(T6718364.X<T>,T), T6718364, , T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X
|
||||||
|
2 warnings
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @bug 6695838
|
||||||
|
* @summary javac does not detect cyclic inheritance involving static inner classes after import clause
|
||||||
|
* @author Maurizio Cimadamore
|
||||||
|
*
|
||||||
|
* @compile/fail a/FooInterface.java
|
||||||
|
*/
|
29
langtools/test/tools/javac/staticImport/6695838/a/Foo.java
Normal file
29
langtools/test/tools/javac/staticImport/6695838/a/Foo.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package a;
|
||||||
|
|
||||||
|
class Foo implements FooInterface {
|
||||||
|
public static interface InnerInterface {}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package a;
|
||||||
|
|
||||||
|
import a.Foo.InnerInterface;
|
||||||
|
|
||||||
|
public interface FooInterface extends Foo.InnerInterface {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user