Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
33 stars 82 forks source link

ClassCustomization addMethod(String method) throws IllegalArgumentException #2706

Open jairmyree opened 5 months ago

jairmyree commented 5 months ago

When adding a new method using addMethod(String method), I get an IllegalArgumentException stating that the method I'm attempting to add does not exist. This should not be the case since the goal is to add a method that does not yet exist.

Autorest Customization:

                "     * Get the applicationId property: An AAD Application ID that was granted the required access permissions to the\n" +
                "     * Azure Key Vault that is to be used when encrypting your data at rest. The Application ID should not be confused\n" +
                "     * with the Object ID for your AAD Application.\n" +
                "     * \n" +
                "     * @return the applicationId value.\n" +
                "     */\n" +
                "    public String getApplicationId() {\n" +
                "        return (this.accessCredentials == null) ? null : this.accessCredentials.getApplicationId();\n" +
                "    }");

Autorest Output:

        at com.azure.autorest.customization.ClassCustomization.getMethod(ClassCustomization.java:177)
        at com.azure.autorest.customization.ClassCustomization.lambda$addMethod$10(ClassCustomization.java:410)
        at com.azure.autorest.customization.implementation.Utils.addImports(Utils.java:498)
        at com.azure.autorest.customization.ClassCustomization.addMethod(ClassCustomization.java:410)
        at com.azure.autorest.customization.ClassCustomization.addMethod(ClassCustomization.java:373)
        at SearchServiceCustomizations.customizeSearchResourceEncryptionKey(SearchServiceCustomizations.java:363)
        at SearchServiceCustomizations.customize(SearchServiceCustomizations.java:68)
        at com.azure.autorest.customization.Customization.run(Customization.java:48)
        ... 11 more
weidongxu-microsoft commented 5 months ago

This could be intermittent, would another try work?

If retry not work, please give your branch and command line so we can reproduce.

@alzimmermsft for awareness.

jairmyree commented 5 months ago

@weidongxu-microsoft @alzimmermsft It was consistent for me, but I'm not sure if it's consistent for other environments.

alzimmermsft commented 5 months ago

@jairmyree could you include the Java version, full stack trace, and a reproduction for this and I should be able to track this down and resolve this.