pulumi / pulumi/pulumi-java

Programgen emits "@" string literals - left over from C#

Open
#571 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/codegen kind/bug language/java size/S
Dominant language
Java
Stars
85
Forks
26
Avg merge
11h 49m
Merged PRs (30d)
22

Description

What happened?
		// This string does contain newlines, so we'll generate a verbatim string literal. Quotes will be escaped
		// in conformance with
		// https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/lexical-structure
		g.Fgen(w, "@\"")
		g.Fgen(w, g.escapeString(v, true, false))
		g.Fgen(w, "\"")

Perhaps this code or something else ends up generating something really strange looking:

https://github.com/pulumi/pulumi-java/runs/6327889540?check_suite_focus=true#step:11:62

Which gets improperly included in javadoc and breaks compilation.

                     @( string.Join(",", DateTime.UtcNow, context.Deployment.ServiceName, context.RequestId, context.Request.IpAddress, context.Operation.Name) ) 
    ```

`DateTime.UtcNow` is also C#-ism.



### Steps to reproduce

See 
https://github.com/pulumi/pulumi-java/runs/6327889540?check_suite_focus=true#step:11:62


### Expected Behavior

Working code generated

### Actual Behavior

Broken code generated

### Versions used

I believe this is coming from pkg/0.1.0 version of programgen.

### Additional context

_No response_

### Contributing

Vote on this issue by adding a 👍 reaction. 
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already). 

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the programgen code that emits string literals and inspect the generated output from the linked run, especially the leading @ and DateTime.UtcNow. Reproduce the failure using the referenced run or generated Java code, then verify that the output contains valid Java and compiles without malformed Javadoc.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.