langtools/test/tools/javac/processing/model/util/elements/TestGetConstantExpression.java
changeset 6720 f16f91662ad8
parent 5520 86e4b9a9da40
child 14963 974d4423c999
equal deleted inserted replaced
6719:1ce993f87850 6720:f16f91662ad8
     1 /*
     1 /*
     2  * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 6471577 6517779
    26  * @bug 6471577 6517779
    27  * @summary Test Elements.getConstantExpression
    27  * @summary Test Elements.getConstantExpression
    28  * @author  Joseph D. Darcy
    28  * @author  Joseph D. Darcy
    29  * @build TestGetConstantExpression
    29  * @library ../../../../lib
       
    30  * @build   JavacTestingAbstractProcessor TestGetConstantExpression
    30  * @compile -processor TestGetConstantExpression Foo.java
    31  * @compile -processor TestGetConstantExpression Foo.java
    31  */
    32  */
    32 
    33 
    33 import java.util.Set;
    34 import java.util.Set;
    34 import javax.annotation.processing.*;
    35 import javax.annotation.processing.*;
    42 import java.io.*;
    43 import java.io.*;
    43 
    44 
    44 /**
    45 /**
    45  * Test basic workings of Elements.getConstantExpression.
    46  * Test basic workings of Elements.getConstantExpression.
    46  */
    47  */
    47 @SupportedAnnotationTypes("*")
    48 public class TestGetConstantExpression extends JavacTestingAbstractProcessor {
    48 public class TestGetConstantExpression extends AbstractProcessor {
       
    49     private Elements eltUtils;
       
    50     private Filer filer;
       
    51     private int round = 1;
    49     private int round = 1;
    52 
    50 
    53     /**
    51     /**
    54      * Check expected behavior on classes and packages.
    52      * Check expected behavior on classes and packages.
    55      */
    53      */
   128             return 1;
   126             return 1;
   129         } catch (IllegalArgumentException iae) {
   127         } catch (IllegalArgumentException iae) {
   130             return 0;
   128             return 0;
   131         }
   129         }
   132     }
   130     }
   133 
       
   134     public SourceVersion getSupportedSourceVersion() {
       
   135         return SourceVersion.latest();
       
   136     }
       
   137 
       
   138     public void init(ProcessingEnvironment processingEnv) {
       
   139         super.init(processingEnv);
       
   140         eltUtils = processingEnv.getElementUtils();
       
   141         filer    = processingEnv.getFiler();
       
   142     }
       
   143 }
   131 }