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

[java] catching Null<T> generates nonsense #7741

Closed
Simn opened this issue Feb 4, 2019 · 1 comment
Closed

[java] catching Null<T> generates nonsense #7741

Simn opened this issue Feb 4, 2019 · 1 comment
Assignees
Labels
platform-java Everything related to Java unresolved Issue was unresolved

Comments

@Simn
Copy link
Member

Simn commented Feb 4, 2019

class Main {
	static public function main() {
		try {
			throw new Main();
		} catch(e:Null<Main>) {
			trace("caught");
		}
	}

	function new() { }
}

This generates:

	public static void main()
	{
		//line 3 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
		try 
		{
			//line 4 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
			try 
			{
				//line 4 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
				throw haxe.lang.HaxeException.wrap(new haxe.root.Main());
			}
			catch (java.lang.Throwable catchallException)
			{
				//line 3 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
				haxe.lang.Exceptions.setException(catchallException);
				//line 6 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
				java.lang.Object realException = ( (( catchallException instanceof haxe.lang.HaxeException )) ? (((haxe.lang.HaxeException) (catchallException) ).obj) : (catchallException) );
				//line 6 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
				if (( realException instanceof [ !TypeError Null ] )) 
				{
					//line 6 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
					haxe.root.Main e = ((haxe.root.Main) (realException) );
					//line 6 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
					haxe.Log.trace.__hx_invoke2_o(0.0, "caught", 0.0, new haxe.lang.DynamicObject(new java.lang.String[]{"className", "fileName", "methodName"}, new java.lang.Object[]{"Main", "source/Main.hx", "main"}, new java.lang.String[]{"lineNumber"}, new double[]{((double) (((double) (6) )) )}));
				}
				else
				{
					//line 6 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
					throw catchallException;
				}
				
			}
			
			
		}
		catch (java.lang.Throwable typedException)
		{
			//line 2 "C:\\GitHub\\HaxeRepro\\source\\Main.hx"
			throw haxe.lang.HaxeException.wrap(typedException);
		}
		
		
	}

Which errors:

src\haxe\root\Main.java:52: error: illegal start of type
                                if (( realException instanceof [ !TypeError Null ] ))
                                                               ^
src\haxe\root\Main.java:52: error: ')' expected
                                if (( realException instanceof [ !TypeError Null ] ))
                                                                ^
src\haxe\root\Main.java:52: error: ';' expected
                                if (( realException instanceof [ !TypeError Null ] ))
                                                                                ^
src\haxe\root\Main.java:52: error: variable declaration not allowed here
                                if (( realException instanceof [ !TypeError Null ] ))
                                                                            ^
src\haxe\root\Main.java:59: error: 'else' without 'if'
                                else
                                ^
5 errors

This blocks #7736. Could be a matter of a missing follow or something worse... Advice appreciated!

@Simn Simn added the platform-java Everything related to Java label Feb 4, 2019
Simn added a commit to Simn/haxe that referenced this issue Feb 4, 2019
@Simn Simn added this to the Backlog milestone May 22, 2019
@Simn Simn added the unresolved Issue was unresolved label Jun 5, 2020
@Simn
Copy link
Member Author

Simn commented Jun 5, 2020

I'm gonna close some Java-specific issues as unresolved.

@Simn Simn closed this as completed Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-java Everything related to Java unresolved Issue was unresolved
Projects
None yet
Development

No branches or pull requests

2 participants