类java.lang.Deprecated源码实例Demo

下面列出了怎么用java.lang.Deprecated的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: javapoet   文件: TypeSpecTest.java
/** https://github.com/square/javapoet/issues/253 */
@Test public void enumWithAnnotatedValues() throws Exception {
  TypeSpec roshambo = TypeSpec.enumBuilder("Roshambo")
      .addModifiers(Modifier.PUBLIC)
      .addEnumConstant("ROCK", TypeSpec.anonymousClassBuilder("")
          .addAnnotation(Deprecated.class)
          .build())
      .addEnumConstant("PAPER")
      .addEnumConstant("SCISSORS")
      .build();
  assertThat(toString(roshambo)).isEqualTo(""
      + "package com.squareup.tacos;\n"
      + "\n"
      + "import java.lang.Deprecated;\n"
      + "\n"
      + "public enum Roshambo {\n"
      + "  @Deprecated\n"
      + "  ROCK,\n"
      + "\n"
      + "  PAPER,\n"
      + "\n"
      + "  SCISSORS\n"
      + "}\n");
}
 
源代码2 项目: javapoet   文件: TypeSpecTest.java
@Test public void innerAnnotationInAnnotationDeclaration() throws Exception {
  TypeSpec bar = TypeSpec.annotationBuilder("Bar")
      .addMethod(MethodSpec.methodBuilder("value")
          .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
          .defaultValue("@$T", Deprecated.class)
          .returns(Deprecated.class)
          .build())
      .build();

  assertThat(toString(bar)).isEqualTo(""
      + "package com.squareup.tacos;\n"
      + "\n"
      + "import java.lang.Deprecated;\n"
      + "\n"
      + "@interface Bar {\n"
      + "  Deprecated value() default @Deprecated;\n"
      + "}\n"
  );
}
 
源代码3 项目: javapoet   文件: TypeSpecTest.java
@Test public void multipleAnnotationAddition() {
  TypeSpec taco = TypeSpec.classBuilder("Taco")
      .addAnnotations(Arrays.asList(
          AnnotationSpec.builder(SuppressWarnings.class)
              .addMember("value", "$S", "unchecked")
              .build(),
          AnnotationSpec.builder(Deprecated.class).build()))
      .build();
  assertThat(toString(taco)).isEqualTo(""
      + "package com.squareup.tacos;\n"
      + "\n"
      + "import java.lang.Deprecated;\n"
      + "import java.lang.SuppressWarnings;\n"
      + "\n"
      + "@SuppressWarnings(\"unchecked\")\n"
      + "@Deprecated\n"
      + "class Taco {\n"
      + "}\n");
}
 
源代码4 项目: apollo-android   文件: TestQuery.java
public Hero(@NotNull String __typename, @NotNull String name,
    @NotNull @Deprecated String deprecated, @Deprecated boolean deprecatedBool) {
  this.__typename = Utils.checkNotNull(__typename, "__typename == null");
  this.name = Utils.checkNotNull(name, "name == null");
  this.deprecated = Utils.checkNotNull(deprecated, "deprecated == null");
  this.deprecatedBool = deprecatedBool;
}
 
源代码5 项目: intellij-pants-plugin   文件: HelloWorld.java
@Deprecated
public static deprecatedMethod() {
  /* bad code to generate warnings and errors */
  int unusedVar;
  if (1 == 2) {
  /* missed bracket: } */
}
 
源代码6 项目: dataenum   文件: Annotation.java
@SuppressWarnings({"floopity", "floop"})
@Deprecated
@MyAnnotation(foo = "hi", fie = 15)
public static Annotation annotatedWithParams() {
  return new AnnotatedWithParams();
}
 
源代码7 项目: apollo-android   文件: TestQuery.java
/**
 * Test deprecated field
 * @deprecated For test purpose only
 */
public @NotNull @Deprecated String deprecated() {
  return this.deprecated;
}
 
源代码8 项目: apollo-android   文件: TestQuery.java
/**
 * Test deprecated field
 * @deprecated For test purpose only
 */
public @Deprecated boolean deprecatedBool() {
  return this.deprecatedBool;
}
 
源代码9 项目: sundrio   文件: WildcardRefFluentImpl.java
/**
 * This method has been deprecated, please use method buildBounds instead.
 * @return The buildable object.
 */
@Deprecated public List<TypeRef> getBounds(){
            return build(bounds);
    }
 
源代码10 项目: sundrio   文件: WildcardRefFluent.java
/**
 * This method has been deprecated, please use method buildBounds instead.
 * @return The buildable object.
 */
@Deprecated public List<TypeRef> getBounds();
 
 类所在包
 同包方法