Skip to content
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

Fix 'Malformed class name' errors in typeName and related implementations #3533

Merged
merged 7 commits into from Sep 28, 2023

Conversation

jared-barocsi
Copy link
Contributor

@jared-barocsi jared-barocsi commented Sep 15, 2023

Replaces instances of getClass.getSimpleName in typeName, which is problematic in Java 8, with a common utility function (which just bundles the default Module.desiredName logic). Also disallows mixing HasAutoTypename into an anonymous Record, which is prone to generating Malformed class name errors.

Compiler plugin change was validated by attempting to compile anonymous Bundle with HasAutoTypename classes, with positive erroring.

Contributor Checklist

  • Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you request a desired merge strategy?
  • Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • Bugfix

Desired Merge Strategy

Squash

Release Notes

  • Introduce a simpleClassName utility object that emulates a getClass.getSimpleName call without throwing Malformed class name exceptions when Java 8 is used. typeName and all related implementations use this function now instead of getClass.getSimpleName.
  • HasAutoTypename can no longer be mixed into an anonymous Record; the compiler plugin now reports this as a compilation error.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels? (Select the most appropriate one based on the "Type of Improvement")
  • Did you mark the proper milestone (Bug fix: 3.5.x, 3.6.x, or 5.x depending on impact, API modification or big change: 6.0)?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you do one of the following when ready to merge:
    • Squash: You/ the contributor Enable auto-merge (squash), clean up the commit message, and label with Please Merge.
    • Merge: Ensure that contributor has cleaned up their commit history, then merge with Create a merge commit.

@jared-barocsi jared-barocsi added the Bugfix Fixes a bug, will be included in release notes label Sep 15, 2023
Copy link
Contributor

@mwachs5 mwachs5 left a comment

Choose a reason for hiding this comment

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

are there any tests we should add? For inner class and or anonymous record?

@jared-barocsi
Copy link
Contributor Author

are there any tests we should add? For inner class and or anonymous record?

I'm not able to add tests since it's a compiler step, the spec would fail compilation if I attempted to mix HasAutoTypename into an anonymous record.

…scala

Co-authored-by: Jack Koenig <koenig@sifive.com>
@jackkoenig jackkoenig added this to the 6.0 milestone Sep 28, 2023
@jared-barocsi jared-barocsi enabled auto-merge (squash) September 28, 2023 16:58
@jared-barocsi jared-barocsi merged commit 4186303 into main Sep 28, 2023
15 checks passed
@jared-barocsi jared-barocsi deleted the fix-typename-malformed-classnames branch September 28, 2023 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Fixes a bug, will be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants