Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
43de744c
Commit
43de744c
authored
Dec 25, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: don't reject type update for generics
parent
2dea6f55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletion
+40
-1
TypeUpdate.java
...java/jadx/core/dex/visitors/typeinference/TypeUpdate.java
+1
-1
TestGenerics.java
.../test/java/jadx/tests/integration/types/TestGenerics.java
+39
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeUpdate.java
View file @
43de744c
...
...
@@ -181,7 +181,6 @@ public final class TypeUpdate {
return
true
;
case
WIDER:
case
WIDER_BY_GENERIC:
return
bound
.
getBound
()
!=
BoundEnum
.
USE
;
case
NARROW:
...
...
@@ -190,6 +189,7 @@ public final class TypeUpdate {
}
return
true
;
case
WIDER_BY_GENERIC:
case
NARROW_BY_GENERIC:
// allow replace object to same object with known generic type
// due to incomplete information about external methods and fields
...
...
jadx-core/src/test/java/jadx/tests/integration/types/TestGenerics.java
0 → 100644
View file @
43de744c
package
jadx
.
tests
.
integration
.
types
;
import
org.junit.Test
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.tests.api.IntegrationTest
;
import
static
jadx
.
tests
.
api
.
utils
.
JadxMatchers
.
containsOne
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
class
TestGenerics
extends
IntegrationTest
{
public
static
class
TestCls
<
T
>
{
private
T
data
;
public
TestCls
<
T
>
data
(
T
t
)
{
this
.
data
=
t
;
return
this
;
}
}
@Test
public
void
test
()
{
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"TestCls<T> data(T t) {"
));
}
@Test
public
void
test2
()
{
// setFallback();
noDebugInfo
();
ClassNode
cls
=
getClassNode
(
TestCls
.
class
);
String
code
=
cls
.
getCode
().
toString
();
assertThat
(
code
,
containsOne
(
"TestCls<T> data(T t) {"
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment