-
Notifications
You must be signed in to change notification settings - Fork 903
polish the TypeInfo system
#2201
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
Open
ZZZank
wants to merge
17
commits into
mozilla:master
Choose a base branch
from
ZZZank:owner-type-gneric
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3ed3a8e
always use method reference as test action in TypeInfoTest
ZZZank db44a40
remove `TypeInfo.collectComponentClass`
ZZZank 114ee7b
remove `NoCacheFactory`
ZZZank 9d1ce0a
support `Outer<T1>.Inner` style parameterized type
ZZZank d063982
rewrite `TypeInfo` formatting mechanism
ZZZank ab7179e
doc for `TypeFormatContext` and better naming of `ClassSignatureForma…
ZZZank 4366087
test and fix TypeFormatContext
ZZZank 907b0d3
add test for `ParameterizedTypeInfo.extractConsolidationMapping(...)`
ZZZank 53ce21f
fix compiling & spotless formatting
ZZZank b01779a
fix decycle
ZZZank 1c84cd5
fix broken formatting for `Outer<T>.Inner` style parameterized type
ZZZank cdf4fec
add doc & test for nested class formatting
ZZZank 73adc59
fix TypeConsolidationMappingTest
ZZZank 686915b
convert Markdown Javadoc
ZZZank 6e02ae7
allow users to pick between `declare` and `use` format mode
ZZZank 82fa146
add test case for primitive class
ZZZank 9d79669
spotless
ZZZank 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 hidden or 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 hidden or 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
104 changes: 91 additions & 13 deletions
104
rhino/src/main/java/org/mozilla/javascript/lc/type/TypeFormatContext.java
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
46 changes: 46 additions & 0 deletions
46
rhino/src/main/java/org/mozilla/javascript/lc/type/impl/ClassNameFormatContext.java
This file contains hidden or 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,46 @@ | ||
| package org.mozilla.javascript.lc.type.impl; | ||
|
|
||
| import org.mozilla.javascript.lc.type.ParameterizedTypeInfo; | ||
| import org.mozilla.javascript.lc.type.TypeFormatContext; | ||
| import org.mozilla.javascript.lc.type.TypeInfo; | ||
| import org.mozilla.javascript.lc.type.VariableTypeInfo; | ||
|
|
||
| /** | ||
| * @author ZZZank | ||
| */ | ||
| public class ClassNameFormatContext implements TypeFormatContext { | ||
| @Override | ||
| public String getClassName(Class<?> c) { | ||
| return c.getName(); | ||
| } | ||
|
|
||
| @Override | ||
| public void append(StringBuilder builder, TypeInfo type) { | ||
| builder.append(type.asClass().getName()); | ||
| } | ||
|
|
||
| @Override | ||
| public void append(StringBuilder builder, TypeInfo type, boolean isComponent) { | ||
| builder.append(type.asClass().getName()); | ||
| } | ||
|
|
||
| @Override | ||
| public void appendParameterized(StringBuilder builder, ParameterizedTypeInfo type) { | ||
| append(builder, type.rawType()); | ||
| } | ||
|
|
||
| @Override | ||
| public void appendVariable(StringBuilder builder, VariableTypeInfo type) { | ||
| append(builder, type.mainBound()); | ||
| } | ||
|
|
||
| @Override | ||
| public void appendArray(StringBuilder builder, TypeInfo type) { | ||
| builder.append(type.asClass().getName()); | ||
| } | ||
|
|
||
| @Override | ||
| public String getFormattedNone() { | ||
| return Object.class.getName(); | ||
| } | ||
| } |
27 changes: 0 additions & 27 deletions
27
rhino/src/main/java/org/mozilla/javascript/lc/type/impl/ClassSignatureFormatContext.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
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.
I think it's worth taking a look at the overall recycle rules for our base package
lc.typeas we keep having to fix them during development. If the intention is that they reflect the future separation of thelccomponents from the main Rhino module thenlcshould have access to whatever is exported from the main module, and we really shouldn't care about anything more precise than that.