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

Matching class names generate incorrect source #434

Open
albfan opened this issue Sep 26, 2023 · 0 comments
Open

Matching class names generate incorrect source #434

albfan opened this issue Sep 26, 2023 · 0 comments

Comments

@albfan
Copy link

albfan commented Sep 26, 2023

for two classes with same name and different package:

bar.MyException;
foo.MyException;

A class using them:

public class Test {
    public static void main(String[] args) {
        boolean flag = true;
        try {
            if(flag) {
                throw new foo.MyException();
            } else {
                throw new bar.MyException();
            }
        } catch (foo.MyException e) {

        } catch (bar.MyException ex) {

        }
    }
}

is decomplied as:

import bar.MyException;
import foo.MyException;

public class Test {
  public static void main(String[] args) {
    boolean flag = true;
    try {
      if (flag)
        throw new MyException(); 
      throw new MyException();
    } catch (MyException myException) {
    
    } catch (MyException myException) {}
  }
}

Is it possible to detect this name match and explicity put which class is used in which place?

I can provide the maven project to test if needed

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

No branches or pull requests

1 participant