pxb1988/dex2jar · error · RuntimeException
can't get owner and type from '"+str+"'
Error message
can't get owner and type from '"+str+"'
What it means
Jasmin.g's parseOwnerAndName splits a 'owner/name' string at the last '/'. If the string contains no '/' at index > 0, it cannot derive owner and name and throws RuntimeException("can't get owner and type from '<str>'").
Solutions
- Write the reference in owner/name form: fully-qualified-class/member-name, e.g. 'java/lang/System/out'
- Verify the token generation includes the class owner before the final '/'
- Add a guard upstream to reject/repair tokens lacking a slash
Example fix
// before .field foo I // after .field com/example/Foo/foo I
Defensive patterns
Strategy: validation
Validate before calling
if (ref == null || ref.lastIndexOf('/') <= 0) throw new IllegalArgumentException("expected owner/name: " + ref); Prevention
- Always emit fully-qualified owner/name tokens in .j files
- Validate field/method reference tokens before writing them
- Escape '/' inside owner segments correctly and rely on lastIndexOf semantics
When it happens
Trigger: Directives expecting a field/method reference like 'owner/name' (e.g. .field or invoke argument tokens) receiving a bare name without a slash, e.g. 'foo' instead of 'com/x/Foo/bar'.
Common situations: Hand-written .j files omitting the class prefix; generators that lost the owner part; escaped names whose only slash is at index 0.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Fail to assemble
- can't pase string
- not support access flags " + name
- RecognitionException on invalid annotation element keyword…
- RecognitionException on invalid annotation element keyword…
AI-assisted analysis of pxb1988/dex2jar@b5bda4fb49 (2026-09-08).
Data as JSON: /api/errors/a46abf2ec4afff71.
Report an issue: GitHub.
Appendix: source
Thrown at d2j-jasmin/src/main/antlr3/com/googlecode/d2j/jasmin/Jasmin.g:680
return 74;
case "astore_0":
return 75;
case "astore_1":
return 76;
case "astore_2":
return 77;
case "astore_3":
return 78;
}
return 0;
}
private String[] parseOwnerAndName(String str) {
int x=str.lastIndexOf('/');
if(x>0){
return new String[]{ unEscape0(str,0,x), unEscape0(str,x+1,str.length()) };
}
throw new RuntimeException("can't get owner and type from '"+str+"'");
}
public Object parseValue(String desc, Object v) {
switch(desc) {
case "Z": return ((Number)v).intValue()!=0;
case "B": return ((Number)v).byteValue();
case "S": return ((Number)v).shortValue();
case "I": return ((Number)v).intValue();
case "F": return ((Number)v).floatValue();
case "D": return ((Number)v).doubleValue();
case "J": return ((Number)v).longValue();
case "C": return (char)((Number)v).intValue();
}
return v;
}
static class AV {
public AnnotationNode visitAnnotation(final String desc, final boolean visible) {
View on GitHub (pinned to b5bda4fb49)