diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md
index 851d0fcc2a8..60411c8aa23 100644
--- a/CHANGELOG_PENDING.md
+++ b/CHANGELOG_PENDING.md
@@ -1,6 +1,7 @@
### Improvements
- Fix emitted functions for `assetArchive` and `remoteAsset` in generated programs
+ - Fix generation of `double` literals in generated programs
- Avoid calling invokes with dependencies on unknown resources
### Bug Fixes
diff --git a/pkg/cmd/pulumi-language-java/language_test.go b/pkg/cmd/pulumi-language-java/language_test.go
index 72327e42f86..8bb6075db19 100644
--- a/pkg/cmd/pulumi-language-java/language_test.go
+++ b/pkg/cmd/pulumi-language-java/language_test.go
@@ -166,12 +166,11 @@ var expectedFailures = map[string]string{
"l2-invoke-options": "#1563 Invoke argument and result handling",
"l2-invoke-options-depends-on": "#1563 Invoke argument and result handling",
"l2-invoke-secrets": "#1563 Invoke argument and result handling",
- "l2-map-keys": "#1569 Spot and qualify duplicate identifiers",
+ "l2-map-keys": "#1561 Map literals are not generated correctly",
"l2-provider-grpc-config-schema-secret": "#1568 Don't generate duplicate files",
"l2-provider-grpc-config-secret": "#1568 Don't generate duplicate files",
"l2-provider-grpc-config": "#1568 Don't generate duplicate files",
"l2-resource-config": "#1566 Fix l2-resource-config / plugin download URL code generation",
- "l2-resource-primitives": "#1565 Better generation of numeric literals",
"l2-resource-secret": "#1564 Fix l2-resource-secret",
}
diff --git a/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/Pulumi.yaml b/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/Pulumi.yaml
new file mode 100644
index 00000000000..6959f9aaf07
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/Pulumi.yaml
@@ -0,0 +1,2 @@
+name: l2-resource-primitives
+runtime: java
diff --git a/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/pom.xml b/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/pom.xml
new file mode 100644
index 00000000000..8954c60fb57
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/pom.xml
@@ -0,0 +1,99 @@
+
+
+ 4.0.0
+
+ com.pulumi
+ l2-resource-primitives
+ 1.0-SNAPSHOT
+
+
+ UTF-8
+ 11
+ 11
+ 11
+ generated_program.App
+
+
+
+
+
+ repository-0
+ REPOSITORY
+
+
+
+
+
+ com.pulumi
+ pulumi
+ CORE.VERSION
+
+
+ com.pulumi
+ primitive
+ 7.0.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.2.2
+
+
+
+ true
+ ${mainClass}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 3.4.2
+
+
+
+ true
+ ${mainClass}
+
+
+
+ jar-with-dependencies
+
+
+
+
+ make-my-jar-with-dependencies
+ package
+
+ single
+
+
+
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+ ${mainClass}
+ ${mainArgs}
+
+
+
+ org.apache.maven.plugins
+ maven-wrapper-plugin
+ 3.1.1
+
+ 3.8.5
+
+
+
+
+
\ No newline at end of file
diff --git a/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/src/main/java/generated_program/App.java b/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/src/main/java/generated_program/App.java
new file mode 100644
index 00000000000..52a3fb05f33
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/projects/l2-resource-primitives/src/main/java/generated_program/App.java
@@ -0,0 +1,37 @@
+package generated_program;
+
+import com.pulumi.Context;
+import com.pulumi.Pulumi;
+import com.pulumi.core.Output;
+import com.pulumi.primitive.Resource;
+import com.pulumi.primitive.ResourceArgs;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class App {
+ public static void main(String[] args) {
+ Pulumi.run(App::stack);
+ }
+
+ public static void stack(Context ctx) {
+ var res = new Resource("res", ResourceArgs.builder()
+ .boolean_(true)
+ .float_(3.14)
+ .integer(42)
+ .string("hello")
+ .numberArray(
+ -1.0,
+ 0.0,
+ 1.0)
+ .booleanMap(Map.ofEntries(
+ Map.entry("t", true),
+ Map.entry("f", false)
+ ))
+ .build());
+
+ }
+}
diff --git a/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/README.md b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/README.md
new file mode 100644
index 00000000000..8d1c8b69c3f
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/README.md
@@ -0,0 +1 @@
+
diff --git a/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/build.gradle b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/build.gradle
new file mode 100644
index 00000000000..4b1f33e7a1b
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/build.gradle
@@ -0,0 +1,157 @@
+// *** WARNING: this file was generated by pulumi-java-gen ***
+// *** Do not edit by hand unless you're certain you know what you are doing! ***
+
+plugins {
+ id("signing")
+ id("java-library")
+ id("maven-publish")
+}
+
+group = "com.pulumi"
+
+def resolvedVersion = System.getenv("PACKAGE_VERSION") ?:
+ (project.version == "unspecified"
+ ? "7.0.0"
+ : project.version)
+
+def signingKey = System.getenv("SIGNING_KEY")
+def signingPassword = System.getenv("SIGNING_PASSWORD")
+def publishRepoURL = System.getenv("PUBLISH_REPO_URL")
+def publishRepoUsername = System.getenv("PUBLISH_REPO_USERNAME")
+def publishRepoPassword = System.getenv("PUBLISH_REPO_PASSWORD")
+
+java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(11)
+ }
+}
+
+compileJava {
+ options.fork = true
+ options.forkOptions.jvmArgs.addAll(["-Xmx16g"])
+ options.encoding = "UTF-8"
+}
+
+repositories {
+ maven {
+ url("REPOSITORY")
+ }
+ mavenLocal()
+ maven { // The google mirror is less flaky than mavenCentral()
+ url("https://maven-central.storage-download.googleapis.com/maven2/")
+ }
+ mavenCentral()
+}
+
+dependencies {
+ implementation("com.google.code.findbugs:jsr305:3.0.2")
+ implementation("com.google.code.gson:gson:2.8.9")
+ implementation("com.pulumi:pulumi:CORE.VERSION")
+}
+
+task sourcesJar(type: Jar) {
+ from sourceSets.main.allJava
+ archiveClassifier.set('sources')
+}
+
+task javadocJar(type: Jar) {
+ from javadoc
+ archiveClassifier.set('javadoc')
+ zip64 = true
+}
+
+def genPulumiResources = tasks.register('genPulumiResources') {
+ doLast {
+ def resourcesDir = sourceSets.main.output.resourcesDir
+ def subDir = project.name.replace(".", "/")
+ def outDir = file("$resourcesDir/$subDir")
+ outDir.mkdirs()
+ new File(outDir, "version.txt").text = resolvedVersion
+ def builder = new groovy.json.JsonBuilder()
+ builder {
+ resource true
+ name "primitive"
+ version resolvedVersion
+ }
+ def infoJson = builder.toPrettyString()
+ new File(outDir, "plugin.json").text = infoJson
+ }
+}
+
+jar.configure {
+ dependsOn genPulumiResources
+}
+
+publishing {
+ publications {
+ mainPublication(MavenPublication) {
+ groupId = "com.pulumi"
+ artifactId = "primitive"
+ version = resolvedVersion
+ from components.java
+ artifact sourcesJar
+ artifact javadocJar
+
+ pom {
+ inceptionYear = ""
+ name = ""
+ packaging = "jar"
+ description = " "
+
+ url = "https://example.com"
+
+ scm {
+ connection = "https://example.com"
+ developerConnection = "https://example.com"
+ url = "https://example.com"
+ }
+
+ licenses {
+ license {
+ name = ""
+ url = ""
+ }
+ }
+
+ developers {
+ developer {
+ id = ""
+ name = ""
+ email = ""
+ }
+ }
+ }
+ }
+ }
+
+ if (publishRepoURL) {
+ repositories {
+ maven {
+ name = "PublishRepo"
+ url = publishRepoURL
+ credentials {
+ username = publishRepoUsername
+ password = publishRepoPassword
+ }
+ }
+ }
+ }
+}
+
+javadoc {
+ if (JavaVersion.current().isJava9Compatible()) {
+ options.addBooleanOption('html5', true)
+ }
+ options.jFlags("-Xmx8g", "-Xms512m")
+}
+
+jar {
+ zip64 = true
+}
+
+if (signingKey) {
+ signing {
+ useInMemoryPgpKeys(signingKey, signingPassword)
+ sign publishing.publications.mainPublication
+ }
+}
\ No newline at end of file
diff --git a/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/settings.gradle b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/settings.gradle
new file mode 100644
index 00000000000..397ed828987
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/settings.gradle
@@ -0,0 +1,14 @@
+// *** WARNING: this file was generated by pulumi-java-gen. ***
+// *** Do not edit by hand unless you're certain you know what you are doing! ***
+
+pluginManagement {
+ repositories {
+ maven { // The google mirror is less flaky than mavenCentral()
+ url("https://maven-central.storage-download.googleapis.com/maven2/")
+ }
+ gradlePluginPortal()
+ }
+}
+
+rootProject.name = "com.pulumi.primitive"
+include("lib")
diff --git a/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/Provider.java b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/Provider.java
new file mode 100644
index 00000000000..615bf00d8b4
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/Provider.java
@@ -0,0 +1,54 @@
+// *** WARNING: this file was generated by pulumi-language-java. ***
+// *** Do not edit by hand unless you're certain you know what you are doing! ***
+
+package com.pulumi.primitive;
+
+import com.pulumi.core.Output;
+import com.pulumi.core.annotations.ResourceType;
+import com.pulumi.core.internal.Codegen;
+import com.pulumi.primitive.ProviderArgs;
+import com.pulumi.primitive.Utilities;
+import javax.annotation.Nullable;
+
+@ResourceType(type="pulumi:providers:primitive")
+public class Provider extends com.pulumi.resources.ProviderResource {
+ /**
+ *
+ * @param name The _unique_ name of the resulting resource.
+ */
+ public Provider(java.lang.String name) {
+ this(name, ProviderArgs.Empty);
+ }
+ /**
+ *
+ * @param name The _unique_ name of the resulting resource.
+ * @param args The arguments to use to populate this resource's properties.
+ */
+ public Provider(java.lang.String name, @Nullable ProviderArgs args) {
+ this(name, args, null);
+ }
+ /**
+ *
+ * @param name The _unique_ name of the resulting resource.
+ * @param args The arguments to use to populate this resource's properties.
+ * @param options A bag of options that control this resource's behavior.
+ */
+ public Provider(java.lang.String name, @Nullable ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
+ super("primitive", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
+ }
+
+ private static ProviderArgs makeArgs(@Nullable ProviderArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
+ if (options != null && options.getUrn().isPresent()) {
+ return null;
+ }
+ return args == null ? ProviderArgs.Empty : args;
+ }
+
+ private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
+ var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
+ .version(Utilities.getVersion())
+ .build();
+ return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
+ }
+
+}
diff --git a/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/ProviderArgs.java b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/ProviderArgs.java
new file mode 100644
index 00000000000..6060ca90506
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/ProviderArgs.java
@@ -0,0 +1,28 @@
+// *** WARNING: this file was generated by pulumi-language-java. ***
+// *** Do not edit by hand unless you're certain you know what you are doing! ***
+
+package com.pulumi.primitive;
+
+
+
+
+public final class ProviderArgs extends com.pulumi.resources.ResourceArgs {
+
+ public static final ProviderArgs Empty = new ProviderArgs();
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder {
+ private ProviderArgs $;
+
+ public Builder() {
+ $ = new ProviderArgs();
+ }
+ public ProviderArgs build() {
+ return $;
+ }
+ }
+
+}
diff --git a/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/Resource.java b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/Resource.java
new file mode 100644
index 00000000000..23f62fe893a
--- /dev/null
+++ b/pkg/cmd/pulumi-language-java/testdata/sdks/primitive-7.0.0/src/main/java/com/pulumi/primitive/Resource.java
@@ -0,0 +1,113 @@
+// *** WARNING: this file was generated by pulumi-language-java. ***
+// *** Do not edit by hand unless you're certain you know what you are doing! ***
+
+package com.pulumi.primitive;
+
+import com.pulumi.core.Output;
+import com.pulumi.core.annotations.Export;
+import com.pulumi.core.annotations.ResourceType;
+import com.pulumi.core.internal.Codegen;
+import com.pulumi.primitive.ResourceArgs;
+import com.pulumi.primitive.Utilities;
+import java.lang.Boolean;
+import java.lang.Double;
+import java.lang.Integer;
+import java.lang.String;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nullable;
+
+@ResourceType(type="primitive:index:Resource")
+public class Resource extends com.pulumi.resources.CustomResource {
+ @Export(name="boolean", refs={Boolean.class}, tree="[0]")
+ private Output boolean_;
+
+ public Output boolean_() {
+ return this.boolean_;
+ }
+ @Export(name="booleanMap", refs={Map.class,String.class,Boolean.class}, tree="[0,1,2]")
+ private Output