Skip to content

Fix Java compilation errors in multi-catch and duplicate variable declaration#30

Merged
b1ume merged 2 commits into
mainfrom
copilot/fix-compilation-errors
Feb 16, 2026
Merged

Fix Java compilation errors in multi-catch and duplicate variable declaration#30
b1ume merged 2 commits into
mainfrom
copilot/fix-compilation-errors

Conversation

Copilot AI commented Feb 15, 2026

Copy link
Copy Markdown
Contributor

Two compilation errors blocking Android build: illegal multi-catch with related exception types and duplicate variable declaration.

Changes

  • HyperionScreenEncoder.java (lines 184, 197): Removed IllegalArgumentException from multi-catch blocks

    • IllegalArgumentException is subclass of RuntimeException, causing "alternatives in multi-catch cannot be related by subclassing" error
    • Catching RuntimeException alone handles both exception types
  • BorderProcessor.java (line 91): Removed duplicate int[] rgb declaration

    • Variable already declared on line 87
// Before
} catch (IllegalArgumentException | RuntimeException e) {

// After  
} catch (RuntimeException e) {

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-all/7iv73wktx1xtkvlq19urqw1wm/gradle-8.10.2/lib/gradle-daemon-main-8.10.2.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-all/7iv73wktx1xtkvlq19urqw1wm/gradle-8.10.2/lib/agents/gradle-instrumentation-agent-8.10.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.10.2 (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Fix the following compilation errors in the Android build:

Issues to Fix

1. HyperionScreenEncoder.java (lines 184 and 197)

Error: Alternatives in a multi-catch statement cannot be related by subclassing

} catch (IllegalArgumentException | RuntimeException e) {

Problem: IllegalArgumentException is a subclass of RuntimeException, so they cannot both be in a multi-catch block.

Solution: Remove IllegalArgumentException from the multi-catch and just catch RuntimeException, since it will catch both IllegalArgumentException and other RuntimeException subclasses.

Change lines 184 and 197 from:

} catch (IllegalArgumentException | RuntimeException e) {

to:

} catch (RuntimeException e) {

2. BorderProcessor.java (line 91)

Error: variable rgb is already defined in method findBorder

int[] rgb = new int[3]; // Reusable array for RGB values

Problem: The variable rgb is declared twice in the same method - once on line 87 and again on line 91.

Solution: Remove the duplicate declaration on line 91 since the variable is already declared on line 87.

Delete line 91:

int[] rgb = new int[3]; // Reusable array for RGB values

Files to Modify

  1. common/src/main/java/com/hyperion/grabber/HyperionScreenEncoder.java
  2. common/src/main/java/com/hyperion/grabber/util/BorderProcessor.java

This pull request was created from Copilot chat.


💡 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.

Co-authored-by: haumlab <222520099+haumlab@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compilation errors in Android build Fix Java compilation errors in multi-catch and duplicate variable declaration Feb 15, 2026
Copilot AI requested a review from b1ume February 15, 2026 23:19
@b1ume
b1ume marked this pull request as ready for review February 16, 2026 01:31
Copilot AI review requested due to automatic review settings February 16, 2026 01:31
@b1ume
b1ume merged commit aa0b573 into main Feb 16, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes two critical Java compilation errors that were blocking the Android build. The changes correctly address illegal multi-catch syntax with related exception types and a duplicate variable declaration.

Changes:

  • Simplified multi-catch blocks in HyperionScreenEncoder.java to catch only RuntimeException instead of the illegal IllegalArgumentException | RuntimeException pattern
  • Removed duplicate int[] rgb variable declaration in BorderProcessor.java

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
common/src/main/java/com/hyperion/grabber/HyperionScreenEncoder.java Fixed illegal multi-catch in createImageReader method (lines 184, 197) by removing IllegalArgumentException from multi-catch since it's a subclass of RuntimeException
common/src/main/java/com/hyperion/grabber/util/BorderProcessor.java Removed duplicate rgb variable declaration that was already defined on line 87

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

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.

3 participants