Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96897b9

Browse files
committed
convert IOException to IOError, test
1 parent 04dd59c commit 96897b9

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

java2python/config/default.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133

134134
# This handler is turns java imports into python imports. No mapping
135135
# of packages is performed:
136-
moduleImportDeclarationHandler = basic.simpleImports
136+
# moduleImportDeclarationHandler = basic.simpleImports
137137

138138
# This import decl. handler can be used instead to produce comments
139139
# instead of import statements:
@@ -243,5 +243,7 @@
243243
'java.lang.String' : 'str',
244244

245245
'Object' : 'object',
246+
246247
'IndexOutOfBoundsException' : 'IndexError',
248+
'IOException': 'IOError',
247249
}

java2python/mod/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def simpleDocString(obj):
3636

3737

3838
def commentedImports(module, expr):
39-
module.factory.comment(parent=module, left=expr, fs='import: {left}')
39+
module.factory.comment(parent=module, left=expr, fs='#import {left}')
4040

4141

4242
def simpleImports(module, expr):

test/Exception0.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.io.IOException;
2+
3+
class Exception0 {
4+
static void test() throws IOException {
5+
throw new IOException("test");
6+
}
7+
8+
public static void main(String[] args) {
9+
try {
10+
test();
11+
} catch (IOException e) {
12+
System.out.println("catch");
13+
} finally {
14+
System.out.println("done");
15+
}
16+
}
17+
}

test/configs/UsePackage0.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from java2python.mod import basic
2+
3+
moduleImportDeclarationHandler = basic.simpleImports

0 commit comments

Comments
 (0)