Skip to content

Conversation

Copy link

Copilot AI commented Jan 1, 2026

The project failed to compile on Java 11+ due to usage of internal JDK APIs that were removed or made inaccessible in newer Java versions.

Changes

Removed Nashorn dependency

  • ClientVersion.java: Removed @Immutable annotation from jdk.nashorn.internal.ir.annotations (Nashorn engine removed in Java 15)
  • Class is already final, making the annotation redundant

Replaced internal reflection API

  • TarsHelper.java and TestForGenericType.java: Changed from sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl to public java.lang.reflect.ParameterizedType interface
// Before
ParameterizedTypeImpl parameterizedType = (ParameterizedTypeImpl) method.getGenericReturnType();

// After
ParameterizedType parameterizedType = (ParameterizedType) method.getGenericReturnType();

Added javax.annotation dependency

  • tars-spring-cloud-starter/pom.xml: Added javax.annotation-api:1.3.2 dependency for @PostConstruct support (removed from JDK in Java 11)

All changes are non-functional replacements using public APIs with identical behavior.

Original prompt

项目编译测试看看


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@TimmyYu TimmyYu marked this pull request as ready for review January 1, 2026 05:54
Copilot AI review requested due to automatic review settings January 1, 2026 05:55
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Removed deprecated jdk.nashorn.internal.ir.annotations.Immutable from ClientVersion
- Replaced sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl with ParameterizedType interface
- Added javax.annotation-api dependency for @PostConstruct annotation support

Co-authored-by: TimmyYu <1688061+TimmyYu@users.noreply.github.com>
Copilot AI changed the title [WIP] Test project compilation process Fix Java 11+ compatibility by removing internal JDK API usage Jan 1, 2026
Copilot AI requested a review from TimmyYu January 1, 2026 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants