test/tools/javac/processing/model/util/elements/TestGetPackageOf.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2010, 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.
@@ -24,11 +24,12 @@
/*
* @test
* @bug 6453386
* @summary Test Elements.getPackageOf
* @author Joseph D. Darcy
- * @build TestGetPackageOf
+ * @library ../../../../lib
+ * @build JavacTestingAbstractProcessor TestGetPackageOf
* @compile -processor TestGetPackageOf -proc:only TestGetPackageOf.java
*/
import java.util.Set;
import javax.annotation.processing.*;
@@ -41,14 +42,11 @@
import static javax.tools.StandardLocation.*;
/**
* Test basic workings of Elements.getPackageOf
*/
-@SupportedAnnotationTypes("*")
-public class TestGetPackageOf extends AbstractProcessor {
- private Elements eltUtils;
-
+public class TestGetPackageOf extends JavacTestingAbstractProcessor {
/**
* Check expected behavior on classes and packages.
*/
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
@@ -67,15 +65,6 @@
if (!unnamedPkg.equals(pkg=eltUtils.getPackageOf(unnamedPkg) ) )
throw new RuntimeException("Unexpected package for unnamed pkg: " + pkg);
}
return true;
}
-
- public SourceVersion getSupportedSourceVersion() {
- return SourceVersion.latest();
- }
-
- public void init(ProcessingEnvironment processingEnv) {
- super.init(processingEnv);
- eltUtils = processingEnv.getElementUtils();
- }
}