-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AVRO-3825: [Java] Disallow invalid namespaces #2430
base: main
Are you sure you want to change the base?
Conversation
Hmm, the Java binding seems to generate namespaces which contain
|
Pending discussion. |
This use of the dollar sign is apparently defined in Java language specification §13.1 (The Form of a Binary), so all Java compilers should generate the same binary name I'd prefer keeping dollar signs disallowed in the Avro specification. Schemas that use dollar signs won't be fully portable to other languages, even if the Java implementation of Avro allows them. It might be useful to have a strict mode that flags them in the Java implementation too, but I don't know how that should be configured. |
I know that |
On a side note, this change may lead to more previously accepted schemata to fail parsing. PR #2448 includes an addition to the specification that describes how to fix this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Foo.java
, M.java
and Test.java
are generated automatically from test.proto
.
/** | ||
* <code>required int32 a = 1;</code> | ||
*/ | ||
public int getA() { |
Check notice
Code scanning / CodeQL
Missing Override annotation
/** | ||
* <code>required int32 a = 1;</code> | ||
*/ | ||
public boolean hasA() { |
Check notice
Code scanning / CodeQL
Missing Override annotation
/** | ||
* <code>required int32 a = 1;</code> | ||
*/ | ||
public int getA() { |
Check notice
Code scanning / CodeQL
Missing Override annotation
/** | ||
* <code>required int32 a = 1;</code> | ||
*/ | ||
public boolean hasA() { |
Check notice
Code scanning / CodeQL
Missing Override annotation
} | ||
|
||
@java.lang.Override | ||
public Builder mergeFrom(com.google.protobuf.Message other) { |
Check notice
Code scanning / CodeQL
Confusing overloading of methods
} | ||
|
||
@java.lang.Override | ||
public Builder mergeFrom(com.google.protobuf.Message other) { |
Check notice
Code scanning / CodeQL
Confusing overloading of methods
if (extensionRegistry == null) { | ||
throw new java.lang.NullPointerException(); | ||
} | ||
int mutable_bitField0_ = 0; |
Check notice
Code scanning / CodeQL
Unread local variable
e8d31ad
to
8238b35
Compare
cc: @RyanSkraba |
Hi Folks - Glad we have a PR to address this issue, it surfaced recently, and was wondering if there are plans to land this fix sometime in the near future. Thanks! 🙂 |
I'll update this PR after this PR is merged because this PR modifies a |
What is the purpose of the change
According to the specification, each portion of a namespace separated by dot should be
[a-zA-Z_][a-zA-Z0-9_]
.https://avro.apache.org/docs/1.11.1/specification/#names
But the current Java binding accept invalid namespaces.
This PR aims to fix this issue.
Verifying this change
Added new test and it passed on my laptop.
Documentation
No new features added.