java.lang.Deprecated Java Examples

The following examples show how to use java.lang.Deprecated. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeSpecTest.java    From javapoet with Apache License 2.0 6 votes vote down vote up
/** 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");
}
 
Example #2
Source File: TypeSpecTest.java    From javapoet with Apache License 2.0 6 votes vote down vote up
@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"
  );
}
 
Example #3
Source File: TypeSpecTest.java    From javapoet with Apache License 2.0 6 votes vote down vote up
@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");
}
 
Example #4
Source File: TestQuery.java    From apollo-android with MIT License 5 votes vote down vote up
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;
}
 
Example #5
Source File: HelloWorld.java    From intellij-pants-plugin with Apache License 2.0 5 votes vote down vote up
@Deprecated
public static deprecatedMethod() {
  /* bad code to generate warnings and errors */
  int unusedVar;
  if (1 == 2) {
  /* missed bracket: } */
}
 
Example #6
Source File: Annotation.java    From dataenum with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({"floopity", "floop"})
@Deprecated
@MyAnnotation(foo = "hi", fie = 15)
public static Annotation annotatedWithParams() {
  return new AnnotatedWithParams();
}
 
Example #7
Source File: TestQuery.java    From apollo-android with MIT License 2 votes vote down vote up
/**
 * Test deprecated field
 * @deprecated For test purpose only
 */
public @NotNull @Deprecated String deprecated() {
  return this.deprecated;
}
 
Example #8
Source File: TestQuery.java    From apollo-android with MIT License 2 votes vote down vote up
/**
 * Test deprecated field
 * @deprecated For test purpose only
 */
public @Deprecated boolean deprecatedBool() {
  return this.deprecatedBool;
}
 
Example #9
Source File: WildcardRefFluentImpl.java    From sundrio with Apache License 2.0 2 votes vote down vote up
/**
 * This method has been deprecated, please use method buildBounds instead.
 * @return The buildable object.
 */
@Deprecated public List<TypeRef> getBounds(){
            return build(bounds);
    }
 
Example #10
Source File: WildcardRefFluent.java    From sundrio with Apache License 2.0 2 votes vote down vote up
/**
 * This method has been deprecated, please use method buildBounds instead.
 * @return The buildable object.
 */
@Deprecated public List<TypeRef> getBounds();