-
Notifications
You must be signed in to change notification settings - Fork 32
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
Skipping over groovy metadata class + groovy test. #118
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f0940d7
Skipping over groovy metadata class + groovy test.
Shounaks b1c4ee2
adding Groovy check for Method retrival.
Shounaks ee4bc8d
Merge branch '2.17' into issue-#93
cowtowncoder 3b11f5b
Move groovy test to under `src/test/groovy`
cowtowncoder 2ea10d9
Changes to make junit-on-groovy test run
cowtowncoder 33ce437
Merge branch '2.17' into issue-#93
cowtowncoder b2fb57c
Merge pom.xml changes from 2.17
cowtowncoder 0566e93
Adding Class Name Condition replicating Jackson-databind.
Shounaks 0f96433
Mix clean up, release notes, update groovy dep to 4.x
cowtowncoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
jr-objects/src/test/java/com/fasterxml/jackson/jr/GroovyTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.fasterxml.jackson.jr | ||
|
||
import com.fasterxml.jackson.jr.ob.JSON | ||
import com.fasterxml.jackson.jr.ob.TestBase | ||
|
||
class GroovyTest extends TestBase { | ||
|
||
void testSimpleObject() throws Exception { | ||
var data = JSON.std.asString(new MyClass()) | ||
var expected = "{\"aDouble\":0.0,\"aStr\":\"stringData\",\"anInt\":0,\"metaClass\":{}}"; | ||
Shounaks marked this conversation as resolved.
Show resolved
Hide resolved
|
||
assertEquals(data, expected) | ||
} | ||
|
||
private class MyClass { | ||
public int anInt; //testing groovy primitive | ||
public String aStr = "stringData"; //testing allocated object | ||
|
||
public double aDouble; // | ||
public Double aDoublesd; //testing boxing object | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to check for class name, not just package, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes correct!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially i implemented it to check for just MetaClassImpl, but after checking jackson-databind, i just replicated its exclusion.
https://github.com/FasterXML/jackson-databind/blob/db95863d6f48cb5695bf8e14af1e7af2ece8e52e/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java#L205
is this correct? or should we go for targeted exclusions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note calling line:
https://github.com/FasterXML/jackson-databind/blob/db95863d6f48cb5695bf8e14af1e7af2ece8e52e/src/main/java/com/fasterxml/jackson/databind/util/BeanUtil.java#L59
which actually checks class name: helper method name is bit misleading I agree. But yes, I think we should target to just that class, unless proven something else is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understood, I missed this code, will implement in a similar fashion.