Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove @Deprecated Java SDK members #1587

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

- Default to using Gradle with the Nexus publishing plugin when using `gen-sdk`
- Support RunPlugin for Maven and Gradle plugins
- Remove `@Deprecated` members from the Java SDK

### Bug Fixes

- Use filepath.Join instead of file.Join
### Bug Fixes
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void stack(Context ctx) {
.name("organization/other/dev")
.build());

ctx.export("plain", ref.getOutput("plain"));
ctx.export("secret", ref.getOutput("secret"));
ctx.export("plain", ref.output("plain"));
ctx.export("secret", ref.output("secret"));
}
}
2 changes: 1 addition & 1 deletion pkg/codegen/java/gen_program_expressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func (g *generator) GenFunctionCallExpression(w io.Writer, expr *model.FunctionC
case "project":
g.Fgen(w, "Deployment.getInstance().getProjectName()")
case "getOutput":
g.Fgenf(w, "%v.getOutput(%v)", expr.Args[0], expr.Args[1])
g.Fgenf(w, "%v.output(%v)", expr.Args[0], expr.Args[1])
case "organization":
g.Fgen(w, "Deployment.getInstance().getOrganizationName()")
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ void testJumboCustomType() {
}).throwOnError();

var resource = result.resources().stream()
.filter(r -> r.getResourceName().equals("testResource"))
.filter(r -> r.pulumiResourceName().equals("testResource"))
.filter(r -> r instanceof ACustomResource)
.map(r -> (ACustomResource) r)
.findFirst()
Expand All @@ -581,4 +581,4 @@ public CompletableFuture<ResourceResult> newResourceAsync(ResourceArgs args) {
throw new IllegalArgumentException(String.format("Unknown resource '%s'", args.type));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,14 @@
* Annotation used by a Pulumi Cloud Provider Package to mark complex types used for a Resource
* output property.
* <p>
* A complex type must have a single constructor
* marked with the @see {@link CustomType.Constructor} annotation,
* or a single builder marked with the @see {@link CustomType.Builder} annotation.
* A complex type must have a single builder marked with the {@link CustomType.Builder} annotation.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface CustomType {

/**
* Annotation used by a Pulumi provider to mark the constructor for a complex
* property type so that it can be instantiated by the Pulumi runtime.
* <p>
* <b>WARNING:</b> nested classes will have a reference to the parent class
* as the first parameter of the constructor ({@code arg0})
* and this type also needs to be deserializable
* or the class needs to be made static.
* This is unlikely scenario, but theoretically possible.
* The invisible fist argument needs also to be named in the annotation value.
* <p>
* The constructor must take parameters annotated with {@link Parameter} that map to
* the resultant @see {@link com.google.protobuf.Struct} returned by the engine.
*
* @deprecated use {@link CustomType.Builder} and {@link CustomType.Setter}
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.CONSTRUCTOR)
@Deprecated
@interface Constructor {
/* Empty */
}

/**
* Annotation used by a Pulumi provider to mark a builder for a complex
* property type so that it can be instantiated by the Pulumi runtime.
* <p>
* The setter must take a parameter annotated with {@link Parameter} that map to
* the resultant @see {@link com.google.protobuf.Struct} returned by the engine.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
Expand All @@ -56,9 +27,6 @@
/**
* Annotation used by a Pulumi provider to mark a setter for a complex
* property type so that it can be instantiated by the Pulumi runtime.
* <p>
* The setter must take a parameter annotated with {@link Parameter} that map to
* the resultant @see {@link com.google.protobuf.Struct} returned by the engine.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
Expand All @@ -71,23 +39,4 @@
*/
String value() default "";
}

/**
* Annotation used by a Pulumi Cloud Provider Package to marks a constructor parameter for a complex
* property type so that it can be instantiated by the Pulumi runtime.
*
* @deprecated use {@link CustomType.Builder} and {@link CustomType.Setter}
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@Deprecated
@interface Parameter {
/**
* We need to know the name of a constructor parameter,
* and unfortunately Java compiler does not give this information through reflection (by default)
*
* @return name of a constructor parameter
*/
String value();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,6 @@
*/
String name() default "";

/**
* @return the generic type parameter of the annotated @see {@link com.pulumi.core.Output}
* @deprecated use {@link #tree()} and {@link #refs()}
*/
@Deprecated
Class<?> type() default Object.class;

/**
* @return the generic type parameters of the @see {@link #type()}
* If not set, the assumption is that the @see {@link #type()} is not a generic type.
* @deprecated use {@link #tree()} and {@link #refs()}
*/
@Deprecated
Class<?>[] parameters() default {};

/**
* @return the generic type parameter tree shape of the annotated @see {@link com.pulumi.core.Output}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,8 @@ public static ImmutableMap<String, ExportMetadata<?>> of(Class<?> extractionType
)));

var fieldType = field.getType();
if (export.refs().length == 0) {
var exportType = export.type();
var parameters = export.parameters();
return of(field, export, fieldType, exportType, parameters);
} else {
var exportTypeNew = TypeShape.fromTree(export.refs(), export.tree());
return of(field, export, fieldType, exportTypeNew);
}
var exportTypeNew = TypeShape.fromTree(export.refs(), export.tree());
return of(field, export, fieldType, exportTypeNew);
})
.collect(toImmutableMap(
ImportExportMetadata::getName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,6 @@ protected Optional<CompletableFuture<Output<String>>> idFuture() {
return Optional.of(this.idFuture);
}

/**
* ID is the provider-assigned unique ID for this managed resource. It is set during
* deployments and may be missing (unknown) during planning phases.
*
* @return the provider-assigned unique ID
* @deprecated use {@link #id()}
*/
@Deprecated
public Output<String> getId() {
return id();
}

/**
* Pulumi ID is the provider-assigned unique ID for this managed resource.
* It is set during deployments and may be missing (unknown) during planning phases.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,6 @@ protected Optional<CompletableFuture<Output<String>>> idFuture() {
return Optional.empty();
}

/**
* The type assigned to the resource at construction.
*
* @return the type of the resource
* @deprecated use {@link #pulumiResourceType()}
*/
@Deprecated
public String getResourceType() {
return type;
}

/**
* The Pulumi type assigned to the resource at construction.
*
Expand All @@ -273,17 +262,6 @@ public String pulumiResourceType() {
return type;
}

/**
* The name assigned to the resource at construction.
*
* @return the name of the resource
* @deprecated use {@link #pulumiResourceName()}
*/
@Deprecated
public String getResourceName() {
return name;
}

/**
* The Pulumi name assigned to the resource at construction.
*
Expand All @@ -293,29 +271,6 @@ public String pulumiResourceName() {
return name;
}

/**
* The child resources of this resource. We use these (only from a @see {@link ComponentResource}) to
* allow code to "dependOn" a @see {@link ComponentResource} and have that effectively mean that it is
* depending on all the @see {@link ComponentResource} children of that component.
* <p>
* Important! We only walk through @see {@link ComponentResource}s. They're the only resources that
* serve as an aggregation of other primitive (i.e.custom) resources.
* While a custom resource can be a parent of other resources, we don't want to ever depend
* on those child resource.
* If we do, it's simple to end up in a situation where we end up depending on a
* child resource that has a data cycle dependency due to the data passed into it.
* This would be pretty nonsensical as there is zero need for a custom resource to
* ever need to reference the urn of a component resource.
* So it's acceptable if that sort of pattern failed in practice.
*
* @return the child resources of this resource
* @deprecated use {@link #pulumiChildResources()}
*/
@Deprecated
public Set<Resource> getChildResources() {
return childResources;
}

/**
* The child resources of this Pulumi resource. We use these (only from a @see {@link ComponentResource}) to
* allow code to "dependOn" a @see {@link ComponentResource} and have that effectively mean that it is
Expand All @@ -337,17 +292,6 @@ public Set<Resource> pulumiChildResources() {
return childResources;
}

/**
* Urn is the stable logical URN used to distinctly address a resource, both before and after deployments.
*
* @return the stable logical URN
* @deprecated use {@link #urn()}
*/
@Deprecated
public Output<String> getUrn() {
return this.urn;
}

/**
* Pulumi URN is the stable logical identifier used to distinctly address a resource,
* both before and after deployments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,46 +47,19 @@ public Resource resource() {
return this.resource;
}

/**
* @return the {@link Resource} instance that is being transformed.
* @deprecated use {@link #resource()}
*/
@Deprecated
public Resource getResource() {
return this.resource;
}

/**
* @return the original properties passed to the {@link Resource} constructor.
*/
public ResourceArgs args() {
return this.args;
}

/**
* @return the original properties passed to the {@link Resource} constructor.
* @deprecated use {@link #args()}
*/
@Deprecated
public ResourceArgs getArgs() {
return this.args;
}

/**
* @return the original resource options passed to the {@link Resource} constructor.
*/
public ResourceOptions options() {
return this.options;
}

/**
* @return the original resource options passed to the {@link Resource} constructor.
* @deprecated use {@link #options()}
*/
@Deprecated
public ResourceOptions getOptions() {
return this.options;
}
}

/**
Expand All @@ -112,29 +85,11 @@ public ResourceArgs args() {
return args;
}

/**
* @return the original properties passed to the Resource constructor.
* @deprecated use {@link #args()}
*/
@Deprecated
public ResourceArgs getArgs() {
return args;
}

/**
* @return the original resource options passed to the Resource constructor.
*/
public ResourceOptions options() {
return options;
}

/**
* @return the original resource options passed to the Resource constructor.
* @deprecated use {@link #options()}
*/
@Deprecated
public ResourceOptions getOptions() {
return options;
}
}
}
}
Loading
Loading