Skip to content

Conversation

@nevi-me
Copy link
Contributor

@nevi-me nevi-me commented Oct 17, 2025

When a table's name is called Table, the Java bindings generated result in an error due to there being 2 Tables. This fixes the issue by fully qualifyng the flatbuffers Table import.

Fixes #8728

@github-actions github-actions bot added c++ codegen Involving generating code from schema java labels Oct 17, 2025
@bjornharrtell
Copy link
Collaborator

@nevi-me why the alias _Vector for Vector?

@bjornharrtell bjornharrtell self-requested a review November 24, 2025 07:34
@maxburke
Copy link
Contributor

Same reason; conflicts with user-defined types named Vector

@nevi-me I think this change might be missing our change to the code from idl_gen_java.cpp that does the renaming of Vector to _Vector

bjornharrtell
bjornharrtell previously approved these changes Nov 25, 2025
@bjornharrtell bjornharrtell requested review from aardappel and removed request for aardappel November 25, 2025 08:31
@bjornharrtell
Copy link
Collaborator

@nevi-me this seems to be causing test failures, do you have possiblity to look at it?

@nevi-me
Copy link
Contributor Author

nevi-me commented Nov 25, 2025

@nevi-me this seems to be causing test failures, do you have possiblity to look at it?

I'll take a look today, thanks

@aardappel
Copy link
Collaborator

the renaming to _Vector causes a lot of churn, breaks the API, and makes the API uglier.. not sure that's worth it over resolving a possible name clash that we haven't had complaints about so far.

@maxburke
Copy link
Contributor

maxburke commented Nov 26, 2025

@aardappel Well, rather than complain about it, we're putting together this PR :) It's not a "possible name clash" for us, it's an actual name clash, and we have deployed code where renaming our Vector type is a really expensive change to make.

What would you suggest as an alternative?

@bjornharrtell
Copy link
Collaborator

Why not just fully qualify as with Table?

@aardappel
Copy link
Collaborator

"renaming our Vector type is a really expensive change to make" yes, that's just what I said about making the change on the FlatBuffers side. Except it is 1 user (you) vs potentially many FlatBuffers users affected, depending on how this collision gets fixed.

Maybe first lets understand the problem. How is your custom vector type set up in a way that it collides with these FlatBuffers Vector types, and why is that unavoidable? Agree with @bjornharrtell that in theory this should all be solvable with qualifying.

@maxburke
Copy link
Contributor

Maybe first lets understand the problem. How is your custom vector type set up in a way that it collides with these FlatBuffers Vector types, and why is that unavoidable? Agree with @bjornharrtell that in theory this should all be solvable with qualifying.

It's a table type called Vector. While some compilation errors can be resolved with full qualification the one we error we were unable to resolve is that the subclass cannot be named the same as its parent:

[ERROR] /Users/max/src/ul/ulsdk/java/src/main/java/com/urbanlogiq/ulsdk/types/generated/Vector.java:[78,23] class com.urbanlogiq.ulsdk.types.generated.Vector is already defined in package com.urbanlogiq.ulsdk.types.generated

@bjornharrtell bjornharrtell self-requested a review November 26, 2025 19:13
@bjornharrtell bjornharrtell dismissed their stale review November 26, 2025 19:14

I'm not convinced of rename of Vector.

@jtdavis777
Copy link
Collaborator

it seems there is some overlap with this PR and #8581

@maxburke
Copy link
Contributor

maxburke commented Dec 1, 2025

it seems there is some overlap with this PR and #8581

Yes, because @aardappel said if #8581 was four PRs it would be easier to review, and there's been no other maintainer activity on it, so @nevi-me helped me split it up in the hopes that we could get these changes accepted and merged so that we don't need to keep as many local patches.

It's not so much "some overlap" as it is #8581 that's been broken up.

@jtdavis777
Copy link
Collaborator

Thank you for the context @maxburke ! I was just going through all the open PRs and noticed that.

Neville Dipale added 2 commits December 1, 2025 16:37
When a table's name is called `Table`, the Java bindings generated result in an error due to there being  2 Tables. This fixes the issue by fully qualifyng the flatbuffers Table import.
@nevi-me nevi-me force-pushed the java-fully-qualify-table-import branch from 2b3c88a to d9ccb92 Compare December 1, 2025 14:37
@nevi-me
Copy link
Contributor Author

nevi-me commented Dec 1, 2025

I'm looking at the failures here, trying to reproduce them locally. I'm seeing a lot of stray changes when I run the formatting scripts, I'm checking if maybe I have a different clang version or something.

Copy link
Collaborator

@bjornharrtell bjornharrtell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this now only does what it says it does, which I think is fine.

@nevi-me
Copy link
Contributor Author

nevi-me commented Dec 1, 2025

I see this now only does what it says it does, which I think is fine.

What I missed is that I have to build flatc from the branch before running it. So I had previously pushed changes from other branches as I was inadvertently using a wrong binary.

@bjornharrtell
Copy link
Collaborator

@aardappel consider for merge

@jtdavis777
Copy link
Collaborator

this also LGTM - since tests pass I'm going to ship it.

@jtdavis777 jtdavis777 merged commit a577050 into google:master Dec 1, 2025
50 checks passed
@nevi-me nevi-me deleted the java-fully-qualify-table-import branch December 1, 2025 17:11
@aardappel
Copy link
Collaborator

A bit messy that this is an exception to all the other things in the com.google.flatbuffers namespace still imported, but.. ok, doesn't hurt anyone I suppose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema java

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java] Schema types named 'Table' clash with the Table import

5 participants