Skip to content

Conversation

@ivanpauno
Copy link
Collaborator

We are currently seeing this warning:

--- stderr: rcljava_common                                                                                                                                                               
warning: [options] bootstrap class path not set in conjunction with -source 6                                                                                                         
warning: [options] source value 6 is obsolete and will be removed in a future release                                                                                                
warning: [options] target value 1.6 is obsolete and will be removed in a future release                                                                                                 
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.                                                                                                         
4 warnings                                                                                                                                                                            
---

Specifying source compatibility with java 6 is deprecated in the target we're building, the only way to ignore the warning is passing -Xlint:-options (or not pass -source 1.6 at all).

I don't think we really need to pass -target 1.6, except if we want to generate classes files specific for that VM version for some reason.
IIUC, we only want to check source compatibility with java 6 to ensure android compatibility.

I don't understand this warning to be honest.

warning: [options] bootstrap class path not set in conjunction with -source 6

AFAIK, passing -source 6 without passing a bootstrap path should be fine.


If we don't have any preference of which version of java to use, I would:

  • Remove CMAKE_JAVA_COMPILE_FLAGS from the CMakeLists.txt files, that will use the latest java version if CMAKE_JAVA_COMPILE_FLAGS is not externally set.
  • Specify a minimum version of java when doing find_package.
  • Set CMAKE_JAVA_COMPILE_FLAGS to -source 1.6 -Xlint:-options in CI so we ensure java 6 compatibility in the codebase.

ivanpauno added 2 commits May 12, 2021 17:49
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@ivanpauno ivanpauno requested a review from jacobperron May 12, 2021 21:07
@ivanpauno ivanpauno added the enhancement New feature or request label May 12, 2021
@jacobperron
Copy link

See a previous discussion here: ros2-java#84

I think removing CMAKE_JAVA_COMPILE_FLAGS makes sense. Since we only care about Java 6 for Android, maybe we can conditionally set it in CMakeLists.txt, e.g.

if(ANDROID)
  set(CMAKE_JAVA_COMPILE_FLAGS "-source" "1.6" "-target" "1.6")
endif()

Until we get Android CI working, it might be good to have a CI variant that turns on Java 6 as well.

@ivanpauno
Copy link
Collaborator Author

ivanpauno commented May 13, 2021

I think removing CMAKE_JAVA_COMPILE_FLAGS makes sense. Since we only care about Java 6 for Android, maybe we can conditionally set it in CMakeLists.txt, e.g.

I'm almost sure we don't need that, the android toolchain will already use "target 1.6" by default.

Until we get Android CI working, it might be good to have a CI variant that turns on Java 6 as well.

Agreed!

@ivanpauno ivanpauno mentioned this pull request May 13, 2021
@ivanpauno
Copy link
Collaborator Author

ivanpauno commented May 13, 2021

Replacing it by #68

@ivanpauno ivanpauno closed this May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants