Skip to content

Add a generic parameter <E> to getExternalInstance#986

Merged
iroqueta merged 2 commits into
masterfrom
fix/issue205291_main-net
Jul 11, 2025
Merged

Add a generic parameter <E> to getExternalInstance#986
iroqueta merged 2 commits into
masterfrom
fix/issue205291_main-net

Conversation

@gusbro

@gusbro gusbro commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

To avoid getting warning: [unchecked] unchecked cast when generated code uses this method. So now instead of being declared as

public ArrayList getExternalInstance()
it is declared as

public <E> ArrayList<E> getExternalInstance()
with being the type parameter.
You can then call the method passing an explicit parameter, e.g.:

chatHistory.<OpenAIResponse.Message>getExternalInstance();
which we currently don't generate, but just using

chatHistory.getExternalInstance();
also does not yield a warning.


Issue: 205291

To avoid getting warning: [unchecked] unchecked cast when generated code uses this method.
So now instead of being declared as

public ArrayList getExternalInstance()

it is declared as

public <E> ArrayList<E> getExternalInstance()

with <E> being the type parameter.
You can then call the method passing an explicit parameter, e.g.:

chatHistory.<OpenAIResponse.Message>getExternalInstance();

which we currently don't generate, but just using

chatHistory.getExternalInstance();

also does not yield a warning.
@gusbro gusbro requested a review from iroqueta July 11, 2025 13:47
@genexusbot

Copy link
Copy Markdown
Collaborator
Cherry pick to beta success

@genexusbot

Copy link
Copy Markdown
Collaborator
Cherry pick to beta success

@iroqueta iroqueta merged commit fd8e133 into master Jul 11, 2025
9 checks passed
@iroqueta iroqueta deleted the fix/issue205291_main-net branch July 11, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants