/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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 6888367
* @summary classfile library parses signature attributes incorrectly
*/
/*
* This test is a pretty detailed test both of javac signature generation and classfile
* signature parsing. The first part of the test tests all the examples given in the
* second part of the test. Each example comes with one or two annotations, @Desc, @Sig,
* for the descriptor and signature of the annotated declaration. Annotations are
* provided whenever the annotated item is expected to have a corresponding value.
* Each annotation has two argument values. The first arg is the expected value of the
* descriptor/signature as found in the class file. This value is mostly for documentation
* purposes in reading the test. The second value is the rendering of the descriptor or
* signature using a custom Type visitor that explicitly includes an indication of the
* Type classes being used to represent the descriptor/signature. Thus we test
* that the descriptor/signature is being parsed into the expected type tree structure.
*/
public class T6888367 {
}
testFields(cf);
if (errors > 0)
}
}
}
}
}
continue;
}
}
}
throws Exception {
return;
}
} else if (s != null)
error("@Sig annotation found but not Signature attribute");
else
error("Signature attribute found but no @Sig annotation");
}
}
try {
} finally {
}
}
}
}
static class AnnotValues {
}
}
throws Exception {
return new AnnotValues(
}
}
}
return null;
}
error("unexpected values found");
}
}
errors++;
}
int errors;
}
return null;
sep = ",";
}
}
}
}
}
}
}
}
}
}
case UNBOUNDED:
return "W{?}";
case EXTENDS:
case SUPER:
default:
throw new AssertionError();
}
}
};
}
@interface Desc {
String d();
String t();
}
@interface Sig {
String s();
String t();
}
class Clss { }
interface Intf { }
class GenClss<T> { }
class Test {
// fields
boolean z;
byte b;
char c;
double d;
float f;
int i;
long l;
short s;
int[] ai;
// methods, return types
void mv0() { }
@Sig(s="<T:Ljava/lang/Object;>()LGenClss<-TT;>;", t="M{<TA{T:cC{java/lang/Object}}>C{GenClss<W{s,S{T}}>}()}")
// methods, arg types
// methods, throws
// inner classes
static class X {
// no sig
class P { }
class Q<TQ> extends P { }
}
static class Y<TY> {
// no sig
class P { }
class Q<TQ> extends P { }
// no sig
class R1 { }
}
class S extends Q<TY> {
// no sig
class S1 { }
@Sig(s="LTest$Y<TTY;>.S.S2<TTY;>;",
t="C{C{C{Test$Y<S{TY}>}.S}.S2<S{TY}>}")
}
}
}