ChristopheJacquet / RdsSurveyor

Multi-platform Radio Data System decoder
http://rds-surveyor.jacquet.xyz/
36 stars 10 forks source link

Compile Error #44

Open andrewfer000 opened 3 years ago

andrewfer000 commented 3 years ago

When compiling on Ubuntu 20.04 I get this error when I try to compile

Task :compileJava FAILED /home/owner/Desktop/RDSSurvey/RdsSurveyor-master/RDSSurveyor/src/eu/jacquet80/rds/ui/MainWindow.java:409: error: local variable stationTuned is accessed from within inner class; needs to be declared final station = stationTuned.getStation();

aerogus commented 3 years ago

On MacOS Catalina, with openjdk 11.0.10 (homebrew install java11) and gradle 7.1.1 (homebrew install gradle), the command gradle jar totally fails.

$ gradle jar

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/gus/workspace/RdsSurveyor/RDSSurveyor/build.gradle' line: 36

* What went wrong:
A problem occurred evaluating root project 'RDSSurveyor'.
> Could not find method compile() for arguments [directory 'lib'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 803ms

I've tried with an older version of gradle : brew uninstall gradle && brew install gradle@6

$ /usr/local/opt/gradle\@6/bin/gradle jar

Welcome to Gradle 6.9!

Here are the highlights of this release:
 - This is a small backport release.
 - Java 16 can be used to compile when used with Java toolchains
 - Dynamic versions can be used within plugin declarations
 - Native support for Apple Silicon processors

For more details see https://docs.gradle.org/6.9/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :compileJava
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.
/Users/gus/workspace/RdsSurveyor/RDSSurveyor/src/eu/jacquet80/rds/ui/MainWindow.java:409: error: local variable stationTuned is accessed from within inner class; needs to be declared final
                                                                station = stationTuned.getStation();
                                                                          ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
3 warnings

> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 9s
1 actionable task: 1 executed
aerogus commented 3 years ago

I've managed to compile the app with the following patch :

$ git diff
diff --git a/RDSSurveyor/src/eu/jacquet80/rds/ui/MainWindow.java b/RDSSurveyor/src/eu/jacquet80/rds/ui/MainWindow.java
index 758790a..9fd2880 100644
--- a/RDSSurveyor/src/eu/jacquet80/rds/ui/MainWindow.java
+++ b/RDSSurveyor/src/eu/jacquet80/rds/ui/MainWindow.java
@@ -398,7 +398,7 @@ public class MainWindow extends JFrame {
                        }

                        @Override
-                       public void visit(StationTuned stationTuned) {
+                       public void visit(final StationTuned stationTuned) {
                                // reset the tabs displayed
                                try {
                                        SwingUtilities.invokeAndWait(new Runnable() {

I'm not a java dev, it's maybe not the best practice but it works now !

lawendel commented 2 years ago

.jar directly downloaded from RdsSurveyor site doesn't recognize the RTL dongle on my MacBook Air M1 Monterey, so I decided to compile.

gradle 7.5.1, however (custom installed, together with openjdk 18.0.2, no Homebrew), generates the same error aerogus has experienced with gradle 7.1.1.

I've tried with his suggestion: compiling with gradle 6.9 and setting StationTuned as "final". No cigar: this time compiling fails due to:

> Could not open proj generic class cache for build file '/Users/lawendel/RdsSurveyor/RDSSurveyor/build.gradle' (/Users/lawendel/.gradle/caches/6.9/scripts/4sqjai8kflxufq3ckyh3ym5nf).
   > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 62

Considering the available binary opens but doesn't manage to access the RTL-SDR dongle, I'm afraid the problem lays with Monterey or M1 or both.