├── .classpath
├── .gitattributes
├── .gitignore
├── .project
├── .settings
├── org.eclipse.jdt.core.prefs
└── org.eclipse.jdt.ui.prefs
├── LICENSE
├── README.md
├── build.properties
├── build.xml
├── lib
└── junit-4.9b2.jar
├── src
└── com
│ └── redhat
│ └── ceylon
│ └── model
│ ├── cmr
│ ├── ArtifactResult.java
│ ├── ArtifactResultType.java
│ ├── ImportType.java
│ ├── JDKUtils.java
│ ├── PathFilter.java
│ ├── Repository.java
│ ├── RepositoryException.java
│ ├── VisibilityType.java
│ ├── package-list.jdk7
│ ├── package-list.jdk8
│ ├── package-list.oracle.jdk7
│ └── package-list.oracle.jdk8
│ ├── loader
│ ├── AbstractModelLoader.java
│ ├── ContentAwareArtifactResult.java
│ ├── JvmBackendUtil.java
│ ├── LanguageAnnotation.java
│ ├── LoaderJULLogger.java
│ ├── ModelCompleter.java
│ ├── ModelLoader.java
│ ├── ModelResolutionException.java
│ ├── NamingBase.java
│ ├── ParameterNameLexer.java
│ ├── ParameterNameParser.java
│ ├── ParameterNameParserException.java
│ ├── SimpleReflType.java
│ ├── Timer.java
│ ├── TypeLexer.java
│ ├── TypeParser.java
│ ├── TypeParserException.java
│ ├── impl
│ │ └── reflect
│ │ │ ├── CachedTOCJars.java
│ │ │ ├── ReflectionModelLoader.java
│ │ │ ├── mirror
│ │ │ ├── ReflectionAnnotation.java
│ │ │ ├── ReflectionClass.java
│ │ │ ├── ReflectionField.java
│ │ │ ├── ReflectionMethod.java
│ │ │ ├── ReflectionPackage.java
│ │ │ ├── ReflectionType.java
│ │ │ ├── ReflectionTypeParameter.java
│ │ │ ├── ReflectionUtils.java
│ │ │ └── ReflectionVariable.java
│ │ │ └── model
│ │ │ ├── ReflectionModule.java
│ │ │ └── ReflectionModuleManager.java
│ ├── mirror
│ │ ├── AccessibleMirror.java
│ │ ├── AnnotatedMirror.java
│ │ ├── AnnotationMirror.java
│ │ ├── ClassMirror.java
│ │ ├── FieldMirror.java
│ │ ├── MethodMirror.java
│ │ ├── PackageMirror.java
│ │ ├── TypeMirror.java
│ │ ├── TypeParameterMirror.java
│ │ └── VariableMirror.java
│ └── model
│ │ ├── AnnotationProxyClass.java
│ │ ├── AnnotationProxyMethod.java
│ │ ├── AnnotationTarget.java
│ │ ├── FieldValue.java
│ │ ├── FunctionOrValueInterface.java
│ │ ├── JavaBeanValue.java
│ │ ├── JavaMethod.java
│ │ ├── LazyClass.java
│ │ ├── LazyClassAlias.java
│ │ ├── LazyContainer.java
│ │ ├── LazyElement.java
│ │ ├── LazyFunction.java
│ │ ├── LazyInterface.java
│ │ ├── LazyInterfaceAlias.java
│ │ ├── LazyModule.java
│ │ ├── LazyModuleManager.java
│ │ ├── LazyPackage.java
│ │ ├── LazyTypeAlias.java
│ │ ├── LazyValue.java
│ │ ├── LocalDeclarationContainer.java
│ │ ├── OutputElement.java
│ │ └── SetterWithLocalDeclarations.java
│ └── typechecker
│ ├── context
│ └── TypeCache.java
│ ├── model
│ ├── Annotated.java
│ ├── Annotation.java
│ ├── Class.java
│ ├── ClassAlias.java
│ ├── ClassOrInterface.java
│ ├── ConditionScope.java
│ ├── Constructor.java
│ ├── ControlBlock.java
│ ├── DecidabilityException.java
│ ├── Declaration.java
│ ├── DeclarationCompleter.java
│ ├── DeclarationKind.java
│ ├── DeclarationWithProximity.java
│ ├── Element.java
│ ├── ExternalUnit.java
│ ├── Function.java
│ ├── FunctionOrValue.java
│ ├── Functional.java
│ ├── Generic.java
│ ├── Getter.java
│ ├── Import.java
│ ├── ImportList.java
│ ├── ImportableScope.java
│ ├── Interface.java
│ ├── InterfaceAlias.java
│ ├── IntersectionType.java
│ ├── LazyType.java
│ ├── ModelUtil.java
│ ├── Module.java
│ ├── ModuleImport.java
│ ├── Modules.java
│ ├── NamedArgumentList.java
│ ├── NothingType.java
│ ├── Package.java
│ ├── Parameter.java
│ ├── ParameterList.java
│ ├── Reference.java
│ ├── Referenceable.java
│ ├── Scope.java
│ ├── Setter.java
│ ├── SiteVariance.java
│ ├── Specification.java
│ ├── Type.java
│ ├── TypeAlias.java
│ ├── TypeDeclaration.java
│ ├── TypeParameter.java
│ ├── TypedDeclaration.java
│ ├── TypedReference.java
│ ├── UnionType.java
│ ├── Unit.java
│ ├── UnknownType.java
│ └── Value.java
│ └── util
│ ├── ModuleManager.java
│ └── TypePrinter.java
└── test
└── .ceylon
└── config
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Always enforce LF line-endings for all text files
2 | * text eol=lf
3 |
4 | # Specific Windows text files
5 | *.bat text eol=crlf
6 |
7 | # Binary files
8 | *.jar binary
9 | *.car binary
10 | *.car.idx binary
11 | *.zip bibary
12 | *.png binary
13 | *.jpg binary
14 | *.gif binary
15 |
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | ceylon-model
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.ui.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | formatter_profile=_ceylon
3 | formatter_settings_version=12
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | DEPRECATED
2 | ==========
3 |
4 | This project is deprecated go here instead: https://github.com/ceylon/ceylon
5 |
--------------------------------------------------------------------------------
/build.properties:
--------------------------------------------------------------------------------
1 |
2 | # ----- JUnit Unit Test Suite, version 4.9 or later ---
3 | junit.version=4.9b2
4 | junit.jar=junit-${junit.version}.jar
5 | junit.url=http://cloud.github.com/downloads/KentBeck/junit/junit${junit.version}.zip
6 | junit.lib=${base.path}/${junit.jar}
7 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
161 |
162 |
163 |
164 |
165 |
166 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
--------------------------------------------------------------------------------
/lib/junit-4.9b2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ceylon/ceylon-model/420b5057259ffb4835866538dced2f7bc95ac1bf/lib/junit-4.9b2.jar
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/ArtifactResult.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.cmr;
2 |
3 | import java.io.File;
4 | import java.util.List;
5 |
6 | /**
7 | * Artifact result.
8 | *
9 | * @author Ales Justin
10 | */
11 | public interface ArtifactResult {
12 | /**
13 | * Get name.
14 | *
15 | * @return the artifact name.
16 | */
17 | String name();
18 |
19 | /**
20 | * Get version.
21 | *
22 | * @return the version.
23 | */
24 | String version();
25 |
26 | /**
27 | * Get import type.
28 | *
29 | * @return the import type
30 | */
31 | ImportType importType();
32 |
33 | /**
34 | * The result type.
35 | *
36 | * @return the type
37 | */
38 | ArtifactResultType type();
39 |
40 | /**
41 | * Get visibility type.
42 | *
43 | * @return visibility type
44 | */
45 | VisibilityType visibilityType();
46 |
47 | /**
48 | * The requested artifact.
49 | *
50 | * @return the requested artifact
51 | * @throws RepositoryException for any I/O error
52 | */
53 | File artifact() throws RepositoryException;
54 |
55 | /**
56 | * The resources filter.
57 | *
58 | * @return the path filter or null if there is none
59 | */
60 | PathFilter filter();
61 |
62 | /**
63 | * Dependencies.
64 | *
65 | * They could be lazily recursively fetched
66 | * or they could be fetched in one go.
67 | *
68 | * @return dependencies, empty list if none
69 | * @throws RepositoryException for any I/O error
70 | */
71 | List dependencies() throws RepositoryException;
72 |
73 | /**
74 | * Get the display string of the repository this
75 | * result comes from
76 | *
77 | * @return the repository display string.
78 | */
79 | String repositoryDisplayString();
80 |
81 | /**
82 | * Get the repository this result was resolved from.
83 | *
84 | * @return the repository this result was resolved from.
85 | */
86 | Repository repository();
87 | }
88 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/ArtifactResultType.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.cmr;
2 |
3 | /**
4 | * Artifact result type.
5 | *
6 | * @author Ales Justin
7 | */
8 | public enum ArtifactResultType {
9 | CEYLON,
10 | MAVEN,
11 | OTHER
12 | }
13 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/ImportType.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.cmr;
2 |
3 | /**
4 | * ImportType type.
5 | *
6 | * @author Ales Justin
7 | */
8 | public enum ImportType {
9 | UNDEFINED,
10 | OPTIONAL,
11 | EXPORT
12 | }
13 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/PathFilter.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.cmr;
2 |
3 | /**
4 | * Filter used to determine whether a path should be included or excluded from imports and exports.
5 | *
6 | * @author John Bailey
7 | * @author Ales Justin
8 | */
9 | public interface PathFilter {
10 |
11 | /**
12 | * Determine whether a path should be accepted. The given name is a path separated
13 | * by "{@code /}" characters.
14 | *
15 | * @param path the path to check
16 | * @return true if the path should be accepted, false if not
17 | */
18 | boolean accept(String path);
19 | }
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/Repository.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.cmr;
2 |
3 | /**
4 | * Abstraction over the CMR Repository type
5 | *
6 | * @author Stéphane Épardaud
7 | */
8 | public interface Repository {
9 | /**
10 | * Returns a display string that represents this Repository
11 | */
12 | String getDisplayString();
13 |
14 | /**
15 | * Return true if this is a Maven repo
16 | */
17 | boolean isMaven();
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/RepositoryException.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.cmr;
2 |
3 | /**
4 | * Wrap any exception into this runtime exception.
5 | *
6 | * @author Ales Justin
7 | */
8 | @SuppressWarnings("serial")
9 | public class RepositoryException extends RuntimeException {
10 | public RepositoryException(String message) {
11 | super(message);
12 | }
13 |
14 | public RepositoryException(String message, Throwable cause) {
15 | super(message, cause);
16 | }
17 |
18 | public RepositoryException(Throwable cause) {
19 | super(cause);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/VisibilityType.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.cmr;
2 |
3 | /**
4 | * Visibility type.
5 | *
6 | * @author Ales Justin
7 | */
8 | public enum VisibilityType {
9 | STRICT, // all deps must be explicity declared; even JDK paths
10 | LOOSE
11 | }
12 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/package-list.jdk7:
--------------------------------------------------------------------------------
1 | # List of JDK modules as currently defined in Jigsaw at
2 | # http://hg.openjdk.java.net/jigsaw/jigsaw/jdk/file/e3ad33822fa3/make/modules/modules.config
3 | # for the package-granularity, and
4 | # http://hg.openjdk.java.net/jigsaw/jigsaw/jdk/file/e3ad33822fa3/make/modules/modules.group
5 | # for the module names.
6 | #
7 | # oracle/sun APIs have been excluded from those modules for now, perhaps this is wrong.
8 | #
9 | # Syntax:
10 | #
11 | # - lines that start with a '#' are comments and are ignored
12 | # - lines that are only whitespace are ignored
13 | # - lines that start with a '=' define the start of a new module name
14 | # - other lines are package names that belong to the current module
15 |
16 | =java.base
17 | java.lang
18 | java.lang.annotation
19 | java.lang.ref
20 | java.lang.reflect
21 | java.math
22 | # Jigsaw excludes java.net.SecureCacheResponse which is in security-jsse
23 | java.net
24 | java.util
25 | java.util.concurrent
26 | java.util.concurrent.atomic
27 | java.util.concurrent.locks
28 | # Jigsaw excludes Pack200
29 | java.util.jar
30 | java.util.regex
31 | java.util.spi
32 | java.util.zip
33 | java.text
34 | java.text.spi
35 | java.lang.invoke
36 | java.io
37 | java.nio
38 | java.nio.channels
39 | java.nio.channels.spi
40 | java.nio.charset
41 | java.nio.charset.spi
42 | java.nio.file
43 | java.nio.file.attribute
44 | java.nio.file.spi
45 | java.security
46 | java.security.cert
47 | java.security.interfaces
48 | java.security.spec
49 | javax.security.auth
50 | javax.security.auth.callback
51 | javax.security.auth.login
52 | javax.security.auth.spi
53 | javax.security.auth.x500
54 | javax.crypto
55 | javax.crypto.interfaces
56 | javax.crypto.spec
57 | # java.beans is only included partially in Jigsaw
58 | java.beans
59 | java.beans.beancontext
60 |
61 | =java.logging
62 | java.util.logging
63 |
64 | =java.management
65 | java.lang.management
66 | javax.management
67 | javax.management.loading
68 | javax.management.modelmbean
69 | javax.management.monitor
70 | javax.management.openmbean
71 | javax.management.relation
72 | javax.management.remote
73 | javax.management.remote.rmi
74 | javax.management.timer
75 |
76 | =java.instrument
77 | java.lang.instrument
78 |
79 | =java.rmi
80 | java.rmi
81 | java.rmi.activation
82 | java.rmi.dgc
83 | java.rmi.registry
84 | java.rmi.server
85 | javax.rmi.ssl
86 |
87 | =java.prefs
88 | java.util.prefs
89 |
90 | # aka security-jsse
91 | =java.tls
92 | javax.net
93 | javax.net.ssl
94 | javax.security.cert
95 |
96 | # aka security-kerberos
97 | =java.auth.kerberos
98 | javax.security.auth.kerberos
99 | org.ietf.jgss
100 |
101 | # aka security-sasl
102 | =java.auth
103 | javax.security.sasl
104 |
105 | # aka security-xmldsig
106 | =javax.xmldsig
107 | javax.xml.crypto
108 | javax.xml.crypto.dom
109 | javax.xml.crypto.dsig
110 | javax.xml.crypto.dsig.dom
111 | javax.xml.crypto.dsig.keyinfo
112 | javax.xml.crypto.dsig.spec
113 | # Seems we're missing org.jcp.xml.dsig, not sure why
114 |
115 | # aka security-acl
116 | =java.security.acl
117 | java.security.acl
118 |
119 | # aka jndi-ldap and jndi
120 | =javax.naming
121 | javax.naming.ldap
122 | javax.naming
123 | javax.naming.directory
124 | javax.naming.event
125 | javax.naming.spi
126 | # seems this includes javax.naming.ldap as well, from jndi-ldap, but it must be a bug in Jigsaw?
127 |
128 | # aka jta
129 | =javax.transaction
130 | javax.transaction
131 | javax.transaction.xa
132 |
133 | =java.jdbc
134 | java.sql
135 | javax.sql
136 |
137 | =java.jdbc.rowset
138 | javax.sql.rowset
139 | javax.sql.rowset.serial
140 | javax.sql.rowset.spi
141 |
142 | # aka scripting
143 | =javax.script
144 | javax.script
145 |
146 | =javax.xml
147 | javax.xml
148 | javax.xml.datatype
149 | javax.xml.namespace
150 | javax.xml.parsers
151 | javax.xml.stream
152 | javax.xml.stream.events
153 | javax.xml.stream.util
154 | javax.xml.transform
155 | javax.xml.transform.dom
156 | javax.xml.transform.sax
157 | javax.xml.transform.stax
158 | javax.xml.transform.stream
159 | javax.xml.validation
160 | javax.xml.xpath
161 | org.w3c.dom
162 | org.w3c.dom.bootstrap
163 | org.w3c.dom.events
164 | org.w3c.dom.ls
165 | org.xml.sax
166 | org.xml.sax.ext
167 | org.xml.sax.helpers
168 |
169 | =javax.jaxws
170 | javax.jws
171 | javax.jws.soap
172 | javax.xml.bind
173 | javax.xml.bind.annotation
174 | javax.xml.bind.annotation.adapters
175 | javax.xml.bind.attachment
176 | javax.xml.bind.helpers
177 | javax.xml.bind.util
178 | javax.xml.soap
179 | javax.xml.ws
180 | javax.xml.ws.handler
181 | javax.xml.ws.handler.soap
182 | javax.xml.ws.http
183 | javax.xml.ws.soap
184 | javax.xml.ws.spi
185 | javax.xml.ws.spi.http
186 | javax.xml.ws.wsaddressing
187 | javax.activation
188 |
189 | =javax.annotation
190 | javax.annotation
191 |
192 | =java.corba
193 | javax.activity
194 | javax.rmi
195 | javax.rmi.CORBA
196 | org.omg.CORBA
197 | org.omg.CORBA.DynAnyPackage
198 | org.omg.CORBA.ORBPackage
199 | org.omg.CORBA.TypeCodePackage
200 | org.omg.CORBA.portable
201 | org.omg.CORBA_2_3
202 | org.omg.CORBA_2_3.portable
203 | org.omg.CosNaming
204 | org.omg.CosNaming.NamingContextExtPackage
205 | org.omg.CosNaming.NamingContextPackage
206 | org.omg.Dynamic
207 | org.omg.DynamicAny
208 | org.omg.DynamicAny.DynAnyFactoryPackage
209 | org.omg.DynamicAny.DynAnyPackage
210 | org.omg.IOP
211 | org.omg.IOP.CodecFactoryPackage
212 | org.omg.IOP.CodecPackage
213 | org.omg.Messaging
214 | org.omg.PortableInterceptor
215 | org.omg.PortableInterceptor.ORBInitInfoPackage
216 | org.omg.PortableServer
217 | org.omg.PortableServer.CurrentPackage
218 | org.omg.PortableServer.POAManagerPackage
219 | org.omg.PortableServer.POAPackage
220 | org.omg.PortableServer.ServantLocatorPackage
221 | org.omg.PortableServer.portable
222 | org.omg.SendingContext
223 | org.omg.stub.java.rmi
224 |
225 | # That one consists in beans, client and applet. But beans is in base for us, because we don't
226 | # do partial package modules, and client consists in awt, imageio, print, sound and swing with
227 | # accessibility
228 | =java.desktop
229 | #applet
230 | java.applet
231 | #client
232 | # awt
233 | java.awt
234 | java.awt.color
235 | java.awt.datatransfer
236 | java.awt.dnd
237 | java.awt.event
238 | java.awt.font
239 | java.awt.geom
240 | java.awt.im
241 | java.awt.im.spi
242 | java.awt.image
243 | java.awt.image.renderable
244 | java.awt.print
245 | # imageio
246 | javax.imageio
247 | javax.imageio.event
248 | javax.imageio.metadata
249 | javax.imageio.plugins.bmp
250 | javax.imageio.plugins.jpeg
251 | javax.imageio.spi
252 | javax.imageio.stream
253 | # print
254 | javax.print
255 | javax.print.attribute
256 | javax.print.attribute.standard
257 | javax.print.event
258 | # sound
259 | javax.sound.midi
260 | javax.sound.midi.spi
261 | javax.sound.sampled
262 | javax.sound.sampled.spi
263 | # swing
264 | javax.swing
265 | javax.swing.border
266 | javax.swing.colorchooser
267 | javax.swing.event
268 | javax.swing.filechooser
269 | javax.swing.plaf
270 | javax.swing.plaf.basic
271 | javax.swing.plaf.basic.icons
272 | javax.swing.plaf.metal
273 | javax.swing.plaf.metal.icons
274 | javax.swing.plaf.metal.icons.ocean
275 | javax.swing.plaf.metal.sounds
276 | javax.swing.plaf.multi
277 | javax.swing.plaf.multi.doc-files
278 | javax.swing.plaf.nimbus
279 | javax.swing.plaf.nimbus.doc-files
280 | javax.swing.plaf.synth
281 | javax.swing.plaf.synth.doc-files
282 | javax.swing.table
283 | javax.swing.text
284 | javax.swing.text.html
285 | javax.swing.text.html.parser
286 | javax.swing.text.rtf
287 | javax.swing.tree
288 | javax.swing.undo
289 | # accessibility
290 | javax.accessibility
291 |
292 | =java.compiler
293 | javax.tools
294 | javax.lang.model
295 | javax.lang.model.element
296 | javax.lang.model.type
297 | javax.lang.model.util
298 | javax.annotation.processing
299 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/cmr/package-list.jdk8:
--------------------------------------------------------------------------------
1 | # List of JDK modules as guessed from package-list.jdk7 + new packages in Java 8:
2 | #
3 | # (added to java.base)
4 | # java.util.function
5 | # java.util.stream
6 | # java.time
7 | # java.time.chrono
8 | # java.time.format
9 | # java.time.temporal
10 | # java.time.zone
11 | #
12 | # (added to javax.xml)
13 | # org.w3c.dom.views
14 | #
15 | # see package-list.jdk7 for syntax and origin
16 |
17 | =java.base
18 | java.lang
19 | java.lang.annotation
20 | java.lang.ref
21 | java.lang.reflect
22 | java.math
23 | # Jigsaw excludes java.net.SecureCacheResponse which is in security-jsse
24 | java.net
25 | java.util
26 | java.util.concurrent
27 | java.util.concurrent.atomic
28 | java.util.concurrent.locks
29 | # Jigsaw excludes Pack200
30 | java.util.function
31 | java.util.jar
32 | java.util.regex
33 | java.util.spi
34 | java.util.stream
35 | java.util.zip
36 | java.text
37 | java.text.spi
38 | java.lang.invoke
39 | java.io
40 | java.nio
41 | java.nio.channels
42 | java.nio.channels.spi
43 | java.nio.charset
44 | java.nio.charset.spi
45 | java.nio.file
46 | java.nio.file.attribute
47 | java.nio.file.spi
48 | java.security
49 | java.security.cert
50 | java.security.interfaces
51 | java.security.spec
52 | javax.security.auth
53 | javax.security.auth.callback
54 | javax.security.auth.login
55 | javax.security.auth.spi
56 | javax.security.auth.x500
57 | javax.crypto
58 | javax.crypto.interfaces
59 | javax.crypto.spec
60 | # java.beans is only included partially in Jigsaw
61 | java.beans
62 | java.beans.beancontext
63 | java.time
64 | java.time.chrono
65 | java.time.format
66 | java.time.temporal
67 | java.time.zone
68 |
69 | =java.logging
70 | java.util.logging
71 |
72 | =java.management
73 | java.lang.management
74 | javax.management
75 | javax.management.loading
76 | javax.management.modelmbean
77 | javax.management.monitor
78 | javax.management.openmbean
79 | javax.management.relation
80 | javax.management.remote
81 | javax.management.remote.rmi
82 | javax.management.timer
83 |
84 | =java.instrument
85 | java.lang.instrument
86 |
87 | =java.rmi
88 | java.rmi
89 | java.rmi.activation
90 | java.rmi.dgc
91 | java.rmi.registry
92 | java.rmi.server
93 | javax.rmi.ssl
94 |
95 | =java.prefs
96 | java.util.prefs
97 |
98 | # aka security-jsse
99 | =java.tls
100 | javax.net
101 | javax.net.ssl
102 | javax.security.cert
103 |
104 | # aka security-kerberos
105 | =java.auth.kerberos
106 | javax.security.auth.kerberos
107 | org.ietf.jgss
108 |
109 | # aka security-sasl
110 | =java.auth
111 | javax.security.sasl
112 |
113 | # aka security-xmldsig
114 | =javax.xmldsig
115 | javax.xml.crypto
116 | javax.xml.crypto.dom
117 | javax.xml.crypto.dsig
118 | javax.xml.crypto.dsig.dom
119 | javax.xml.crypto.dsig.keyinfo
120 | javax.xml.crypto.dsig.spec
121 | # Seems we're missing org.jcp.xml.dsig, not sure why
122 |
123 | # aka security-acl
124 | =java.security.acl
125 | java.security.acl
126 |
127 | # aka jndi-ldap and jndi
128 | =javax.naming
129 | javax.naming.ldap
130 | javax.naming
131 | javax.naming.directory
132 | javax.naming.event
133 | javax.naming.spi
134 | # seems this includes javax.naming.ldap as well, from jndi-ldap, but it must be a bug in Jigsaw?
135 |
136 | # aka jta
137 | =javax.transaction
138 | javax.transaction
139 | javax.transaction.xa
140 |
141 | =java.jdbc
142 | java.sql
143 | javax.sql
144 |
145 | =java.jdbc.rowset
146 | javax.sql.rowset
147 | javax.sql.rowset.serial
148 | javax.sql.rowset.spi
149 |
150 | # aka scripting
151 | =javax.script
152 | javax.script
153 |
154 | =javax.xml
155 | javax.xml
156 | javax.xml.datatype
157 | javax.xml.namespace
158 | javax.xml.parsers
159 | javax.xml.stream
160 | javax.xml.stream.events
161 | javax.xml.stream.util
162 | javax.xml.transform
163 | javax.xml.transform.dom
164 | javax.xml.transform.sax
165 | javax.xml.transform.stax
166 | javax.xml.transform.stream
167 | javax.xml.validation
168 | javax.xml.xpath
169 | org.w3c.dom
170 | org.w3c.dom.bootstrap
171 | org.w3c.dom.events
172 | org.w3c.dom.ls
173 | org.w3c.dom.views
174 | org.xml.sax
175 | org.xml.sax.ext
176 | org.xml.sax.helpers
177 |
178 | =javax.jaxws
179 | javax.jws
180 | javax.jws.soap
181 | javax.xml.bind
182 | javax.xml.bind.annotation
183 | javax.xml.bind.annotation.adapters
184 | javax.xml.bind.attachment
185 | javax.xml.bind.helpers
186 | javax.xml.bind.util
187 | javax.xml.soap
188 | javax.xml.ws
189 | javax.xml.ws.handler
190 | javax.xml.ws.handler.soap
191 | javax.xml.ws.http
192 | javax.xml.ws.soap
193 | javax.xml.ws.spi
194 | javax.xml.ws.spi.http
195 | javax.xml.ws.wsaddressing
196 | javax.activation
197 |
198 | =javax.annotation
199 | javax.annotation
200 |
201 | =java.corba
202 | javax.activity
203 | javax.rmi
204 | javax.rmi.CORBA
205 | org.omg.CORBA
206 | org.omg.CORBA.DynAnyPackage
207 | org.omg.CORBA.ORBPackage
208 | org.omg.CORBA.TypeCodePackage
209 | org.omg.CORBA.portable
210 | org.omg.CORBA_2_3
211 | org.omg.CORBA_2_3.portable
212 | org.omg.CosNaming
213 | org.omg.CosNaming.NamingContextExtPackage
214 | org.omg.CosNaming.NamingContextPackage
215 | org.omg.Dynamic
216 | org.omg.DynamicAny
217 | org.omg.DynamicAny.DynAnyFactoryPackage
218 | org.omg.DynamicAny.DynAnyPackage
219 | org.omg.IOP
220 | org.omg.IOP.CodecFactoryPackage
221 | org.omg.IOP.CodecPackage
222 | org.omg.Messaging
223 | org.omg.PortableInterceptor
224 | org.omg.PortableInterceptor.ORBInitInfoPackage
225 | org.omg.PortableServer
226 | org.omg.PortableServer.CurrentPackage
227 | org.omg.PortableServer.POAManagerPackage
228 | org.omg.PortableServer.POAPackage
229 | org.omg.PortableServer.ServantLocatorPackage
230 | org.omg.PortableServer.portable
231 | org.omg.SendingContext
232 | org.omg.stub.java.rmi
233 |
234 | # That one consists in beans, client and applet. But beans is in base for us, because we don't
235 | # do partial package modules, and client consists in awt, imageio, print, sound and swing with
236 | # accessibility
237 | =java.desktop
238 | #applet
239 | java.applet
240 | #client
241 | # awt
242 | java.awt
243 | java.awt.color
244 | java.awt.datatransfer
245 | java.awt.dnd
246 | java.awt.event
247 | java.awt.font
248 | java.awt.geom
249 | java.awt.im
250 | java.awt.im.spi
251 | java.awt.image
252 | java.awt.image.renderable
253 | java.awt.print
254 | # imageio
255 | javax.imageio
256 | javax.imageio.event
257 | javax.imageio.metadata
258 | javax.imageio.plugins.bmp
259 | javax.imageio.plugins.jpeg
260 | javax.imageio.spi
261 | javax.imageio.stream
262 | # print
263 | javax.print
264 | javax.print.attribute
265 | javax.print.attribute.standard
266 | javax.print.event
267 | # sound
268 | javax.sound.midi
269 | javax.sound.midi.spi
270 | javax.sound.sampled
271 | javax.sound.sampled.spi
272 | # swing
273 | javax.swing
274 | javax.swing.border
275 | javax.swing.colorchooser
276 | javax.swing.event
277 | javax.swing.filechooser
278 | javax.swing.plaf
279 | javax.swing.plaf.basic
280 | javax.swing.plaf.basic.icons
281 | javax.swing.plaf.metal
282 | javax.swing.plaf.metal.icons
283 | javax.swing.plaf.metal.icons.ocean
284 | javax.swing.plaf.metal.sounds
285 | javax.swing.plaf.multi
286 | javax.swing.plaf.multi.doc-files
287 | javax.swing.plaf.nimbus
288 | javax.swing.plaf.nimbus.doc-files
289 | javax.swing.plaf.synth
290 | javax.swing.plaf.synth.doc-files
291 | javax.swing.table
292 | javax.swing.text
293 | javax.swing.text.html
294 | javax.swing.text.html.parser
295 | javax.swing.text.rtf
296 | javax.swing.tree
297 | javax.swing.undo
298 | # accessibility
299 | javax.accessibility
300 |
301 | =java.compiler
302 | javax.tools
303 | javax.lang.model
304 | javax.lang.model.element
305 | javax.lang.model.type
306 | javax.lang.model.util
307 | javax.annotation.processing
308 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/ContentAwareArtifactResult.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | import java.net.URI;
4 | import java.util.Collection;
5 | import java.util.List;
6 |
7 | import com.redhat.ceylon.model.cmr.ArtifactResult;
8 |
9 | public interface ContentAwareArtifactResult extends ArtifactResult {
10 | Collection getPackages();
11 | Collection getEntries();
12 | byte[] getContents(String path);
13 | URI getContentUri(String path);
14 | List getFileNames(String path);
15 | }
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/LoaderJULLogger.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | import com.redhat.ceylon.common.log.JULLogger;
4 |
5 | /**
6 | * Simple logger impl.
7 | *
8 | * @author Stephane Epardaud, Tako Schotanus
9 | */
10 | public class LoaderJULLogger extends JULLogger {
11 |
12 | static java.util.logging.Logger log = java.util.logging.Logger.getLogger("com.redhat.ceylon.log.loader");
13 |
14 | @Override
15 | protected java.util.logging.Logger logger() {
16 | return log;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/ModelCompleter.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | import com.redhat.ceylon.model.loader.model.LazyClass;
4 | import com.redhat.ceylon.model.loader.model.LazyClassAlias;
5 | import com.redhat.ceylon.model.loader.model.LazyInterface;
6 | import com.redhat.ceylon.model.loader.model.LazyInterfaceAlias;
7 | import com.redhat.ceylon.model.loader.model.LazyFunction;
8 | import com.redhat.ceylon.model.loader.model.LazyTypeAlias;
9 | import com.redhat.ceylon.model.loader.model.LazyValue;
10 |
11 | /**
12 | * Represents something which can complete a model if needed. This is used because we load declarations lazily,
13 | * so we only fully load them when needed.
14 | *
15 | * @author Stéphane Épardaud
16 | */
17 | public interface ModelCompleter {
18 |
19 | /**
20 | * Completes loading of a class
21 | */
22 | void complete(LazyClass lazyClass);
23 |
24 | /**
25 | * Completes loading of a class's type parameters only
26 | */
27 | void completeTypeParameters(LazyClass lazyClass);
28 |
29 | /**
30 | * Completes loading of an interface
31 | */
32 | void complete(LazyInterface lazyInterface);
33 |
34 | /**
35 | * Completes loading of an interface's type parameters only
36 | */
37 | void completeTypeParameters(LazyInterface lazyInterface);
38 |
39 | /**
40 | * Completes loading of a toplevel attribute
41 | */
42 | void complete(LazyValue lazyValue);
43 |
44 | /**
45 | * Completes loading of a toplevel method
46 | */
47 | void complete(LazyFunction lazyMethod);
48 |
49 | /**
50 | * Completes loading of a lazy class alias
51 | */
52 | void complete(LazyClassAlias lazyClassAlias);
53 |
54 | /**
55 | * Completes loading of a lazy class alias's type parameters only
56 | */
57 | void completeTypeParameters(LazyClassAlias lazyClassAlias);
58 |
59 | /**
60 | * Completes loading of a lazy interface alias
61 | */
62 | void complete(LazyInterfaceAlias lazyInterfaceAlias);
63 |
64 | /**
65 | * Completes loading of a lazy interface alias's type parameters only
66 | */
67 | void completeTypeParameters(LazyInterfaceAlias lazyInterfaceAlias);
68 |
69 | /**
70 | * Completes loading of a lazy type alias
71 | */
72 | void complete(LazyTypeAlias lazyTypeAlias);
73 |
74 | /**
75 | * Completes loading of a lazy type alias's type parameters only
76 | */
77 | void completeTypeParameters(LazyTypeAlias lazyTypeAlias);
78 |
79 | /**
80 | * Returns a lock we can use for thread-safety
81 | */
82 | Object getLock();
83 | }
84 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/ModelLoader.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | import com.redhat.ceylon.model.typechecker.model.Declaration;
4 | import com.redhat.ceylon.model.typechecker.model.Module;
5 | import com.redhat.ceylon.model.typechecker.model.Type;
6 | import com.redhat.ceylon.model.typechecker.model.Scope;
7 |
8 | /**
9 | * Represents a ModelLoader's public API
10 | *
11 | * @author Stéphane Épardaud
12 | */
13 | public interface ModelLoader {
14 |
15 | /**
16 | * The type of declaration we're looking for. This is useful for toplevel attributes and classes who
17 | * can share the same name (in the case of singletons).
18 | *
19 | * @author Stéphane Épardaud
20 | */
21 | enum DeclarationType {
22 | /**
23 | * We're looking for a type
24 | */
25 | TYPE,
26 | /**
27 | * We're looking for an attribute
28 | */
29 | VALUE;
30 | }
31 |
32 | /**
33 | * Loads a declaration by name and type
34 | *
35 | * @param module the module to load it from
36 | * @param typeName the fully-qualified declaration name
37 | * @param declarationType the declaration type
38 | * @return the declaration, if found, or null.
39 | */
40 | public Declaration getDeclaration(Module module, String typeName, DeclarationType declarationType);
41 |
42 | /**
43 | * Returns the Type of a name in a given scope
44 |
45 | * @param module the module to load it from
46 | * @param pkg the package name
47 | * @param name the fully-qualified name of the type
48 | * @param scope the scope in which to find it
49 | * @return the Type found
50 | */
51 | public Type getType(Module module, String pkg, String name, Scope scope);
52 |
53 | /**
54 | * Returns the Declaration of a name in a given scope
55 |
56 | * @param module the module to load it from
57 | * @param pkg the package name
58 | * @param name the fully-qualified name of the type
59 | * @param scope the scope in which to find it
60 | * @return the Type found
61 | */
62 | public Declaration getDeclaration(Module module, String pkg, String name, Scope scope);
63 |
64 | /**
65 | * Returns a loaded module by name and version
66 | * @return null if module is not already loaded
67 | */
68 | public Module getLoadedModule(String moduleName, String version);
69 | }
70 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/ModelResolutionException.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | @SuppressWarnings("serial")
4 | public class ModelResolutionException extends RuntimeException {
5 |
6 | public ModelResolutionException() {
7 | super();
8 | }
9 |
10 | public ModelResolutionException(String message, Throwable cause) {
11 | super(message, cause);
12 | }
13 |
14 | public ModelResolutionException(String message) {
15 | super(message);
16 | }
17 |
18 | public ModelResolutionException(Throwable cause) {
19 | super(cause);
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/ParameterNameLexer.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | class ParameterNameLexer {
4 |
5 | public static final int COMMA = 0;
6 | public static final int LEFT_PAREN = COMMA+1;
7 | public static final int RIGHT_PAREN = LEFT_PAREN+1;
8 | public static final int IDENT = RIGHT_PAREN+1;
9 | public static final int PLUS = IDENT+1;
10 | public static final int STAR = PLUS+1;
11 | public static final int BANG = STAR+1;
12 | public static final int EOI = BANG+1;
13 |
14 | // type string to parse
15 | String input;
16 | int index = 0;
17 | int mark = -1;
18 |
19 | public ParameterNameLexer(){}
20 |
21 | public String toString() {
22 | StringBuilder sb = new StringBuilder();
23 | sb.append(input).append(System.lineSeparator());
24 | for (int ii = 0; ii < index; ii++) {
25 | sb.append(' ');
26 | }
27 | sb.append('^');
28 | return sb.toString();
29 | }
30 |
31 | public void setup(String input){
32 | this.input = input;
33 | index = 0;
34 | }
35 |
36 | private int peek(){
37 | if(index >= input.length())
38 | return EOI;
39 | int c = input.codePointAt(index);
40 | int token;
41 | switch(c){
42 | case '(': token = LEFT_PAREN; break;
43 | case ')': token = RIGHT_PAREN; break;
44 | case ',': token = COMMA; break;
45 | case '+': token = PLUS; break;
46 | case '*': token = STAR; break;
47 | case '!': token = BANG; break;
48 | default:
49 | if (isIdentifierPart(c)) {
50 | token = IDENT;
51 | } else {
52 | throw new ParameterNameParserException("Unknown codepoint=" + c + "\n" + this);
53 | }
54 | }
55 | return token;
56 | }
57 |
58 | private boolean isIdentifierPart(int codepoint) {
59 | return Character.isLowerCase(codepoint)
60 | || Character.isUpperCase(codepoint)
61 | || Character.isDigit(codepoint)
62 | || codepoint == '_';
63 | }
64 |
65 | public void eat() {
66 | int token = peek();
67 | switch(token) {
68 | case LEFT_PAREN:
69 | case RIGHT_PAREN:
70 | case COMMA:
71 | case PLUS:
72 | case STAR:
73 | case BANG:
74 | index += 1;
75 | return;
76 | case IDENT:
77 | index += Character.charCount(input.codePointAt(index));
78 | int c = input.codePointAt(index);
79 | while (index < input.length()
80 | && isIdentifierPart(c)) {
81 | index += Character.charCount(input.codePointAt(index));
82 | c = input.codePointAt(index);
83 | }
84 | return;
85 | case EOI:
86 | return;
87 | default:
88 | throw new ParameterNameParserException("Unknown token=" + token+"\n" + this);
89 | }
90 | }
91 |
92 | public String eatIdentifier() {
93 | int index = this.index;
94 | eat(IDENT);
95 | return input.substring(index, this.index);
96 | }
97 |
98 | public void eat(int token) {
99 | if(!lookingAt(token)){
100 | throw new ParameterNameParserException("Missing expected token: "+tokenToString(token)+System.lineSeparator()
101 | + this);
102 | }
103 | eat();
104 | }
105 |
106 | private String tokenToString(int token) {
107 | switch (token) {
108 | case COMMA: return "COMMA";
109 | case IDENT: return "IDENT";
110 | case LEFT_PAREN: return "LEFT_PAREN";
111 | case RIGHT_PAREN: return "RIGHT_PAREN";
112 | case EOI: return "EOI";
113 | case PLUS: return "PLUS";
114 | case STAR: return "STAR";
115 | case BANG: return "BANG";
116 | }
117 | throw new ParameterNameParserException("Unknown token " + token);
118 | }
119 |
120 | public boolean lookingAt(int token) {
121 | return peek() == token;
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/ParameterNameParser.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | import static com.redhat.ceylon.model.loader.ParameterNameLexer.*;
4 |
5 | import java.util.ArrayList;
6 | import java.util.Iterator;
7 | import java.util.List;
8 |
9 | import com.redhat.ceylon.model.typechecker.model.Function;
10 | import com.redhat.ceylon.model.typechecker.model.FunctionOrValue;
11 | import com.redhat.ceylon.model.typechecker.model.Parameter;
12 | import com.redhat.ceylon.model.typechecker.model.ParameterList;
13 | import com.redhat.ceylon.model.typechecker.model.Type;
14 | import com.redhat.ceylon.model.typechecker.model.Unit;
15 | import com.redhat.ceylon.model.typechecker.model.Value;
16 |
17 | /**
18 | * Parser for {@link com.redhat.ceylon.compiler.java.metadata.FunctionalParameter#value()}.
19 | *
20 | * input ::= ( '!' )? nameList ( nameList )*
21 | * nameList ::= '(' ( name ( ',' name )* )? ')'
22 | * name ::= identifier ( '+' | '*' )? ( '!' )? ( nameList )*
23 | *
24 | *
25 | * - A {@code !} means that the {@code Function} model is declared {@code void}
26 | * - A {@code +} means that the {@code Parameter} model is possibly-empty variadic
27 | * - A {@code *} means that the {@code Parameter} model is nonempty variadic
28 | *
29 | * @author tom
30 | */
31 | class ParameterNameParser {
32 |
33 | private final ParameterNameLexer lexer = new ParameterNameLexer();
34 | private final AbstractModelLoader loader;
35 | private Unit unit;
36 |
37 |
38 |
39 | ParameterNameParser(AbstractModelLoader loader) {
40 | this.loader = loader;
41 | }
42 |
43 | public void parse(String input, Type type, Function method) {
44 | lexer.setup(input);
45 | this.unit = method.getUnit();
46 | boolean declaredVoid = false;
47 | ArrayList lists = new ArrayList<>();
48 | if (lexer.lookingAt(BANG)) {
49 | lexer.eat();
50 | declaredVoid = true;
51 | }
52 | lists.add(parseNameList(type, method));
53 | while (lexer.lookingAt(LEFT_PAREN)) {// mpl
54 | type = loader.getSimpleCallableReturnType(type);
55 | lists.add(parseNameList(type, method));
56 | }
57 | for (ParameterList parameterList : lists) {
58 | method.addParameterList(parameterList);
59 | }
60 | method.setDeclaredVoid(declaredVoid);
61 | method.setType(loader.getSimpleCallableReturnType(type));
62 | if (!lexer.lookingAt(EOI)) {
63 | throw new ParameterNameParserException("Expected end of input" + System.lineSeparator() + input);
64 | }
65 | }
66 | public void parseMpl(String input, Type type, Function method) {
67 | lexer.setup(input);
68 | this.unit = method.getUnit();
69 | ArrayList lists = new ArrayList<>();
70 | lists.add(parseNameList(type, method));
71 | while (lexer.lookingAt(LEFT_PAREN)) {// mpl
72 | type = loader.getSimpleCallableReturnType(type);
73 | lists.add(parseNameList(type, method));
74 | }
75 | for (ParameterList parameterList : lists) {
76 | method.addParameterList(parameterList);
77 | }
78 | method.setType(loader.getSimpleCallableReturnType(type));
79 | if (!lexer.lookingAt(EOI)) {
80 | throw new ParameterNameParserException("Expected end of input" + System.lineSeparator() + input);
81 | }
82 | }
83 | private ParameterList parseNameList(Type type, Function method) {
84 | ParameterList pl = new ParameterList();
85 | List parameters = pl.getParameters();
86 | //startParameterList();
87 | lexer.eat(LEFT_PAREN);
88 | if (!lexer.lookingAt(RIGHT_PAREN)) {
89 | Iterator ct = loader.getSimpleCallableArgumentTypes(type).iterator();
90 | if (!ct.hasNext()) {
91 | throw new ParameterNameParserException("Too few parameter types");
92 | }
93 | parameters.add(parseName(ct.next(), method));
94 | // addParameter()
95 | while (lexer.lookingAt(COMMA)) {
96 | lexer.eat();
97 | if (!ct.hasNext()) {
98 | throw new ParameterNameParserException("Too few parameter types");
99 | }
100 | parameters.add(parseName(ct.next(), method));
101 | }
102 | if (ct.hasNext()) {
103 | throw new ParameterNameParserException("Too many parameter types");
104 | }
105 | }
106 | lexer.eat(RIGHT_PAREN);
107 | //endParameterList();
108 | return pl;
109 | }
110 |
111 | private Parameter parseName(Type type, Function container) {
112 | String identifier = lexer.eatIdentifier();
113 | boolean declaredVoid = false;
114 | boolean sequenced = false;
115 | boolean atLeastOne = false;
116 | if (lexer.lookingAt(STAR)) {
117 | lexer.eat();
118 | sequenced = true;
119 | } else if (lexer.lookingAt(PLUS)) {
120 | lexer.eat();
121 | sequenced = true;
122 | atLeastOne = true;
123 | }
124 | if (lexer.lookingAt(BANG)) {
125 | lexer.eat();
126 | declaredVoid = true;
127 | }
128 |
129 | final FunctionOrValue result;
130 | if (lexer.lookingAt(LEFT_PAREN)) {
131 | // functionParameter()
132 | result = parseMethod(type, declaredVoid);
133 | } else {
134 | if (declaredVoid) {
135 | throw new ParameterNameParserException("void Value");
136 | }
137 | // valueParameter();
138 | result = parseValue(type);
139 | }
140 | result.setName(identifier);
141 | result.setUnit(unit);
142 | result.setContainer(container);
143 | result.setScope(container);
144 | Parameter p = new Parameter();
145 | p.setName(identifier);
146 | p.setSequenced(sequenced);
147 | p.setAtLeastOne(atLeastOne);
148 | p.setDeclaredAnything(declaredVoid);
149 | p.setModel(result);
150 | result.setInitializerParameter(p);
151 | container.addMember(result);
152 | return p;
153 | }
154 |
155 | private Value parseValue(Type type) {
156 | Value value = new Value();
157 | value.setType(type);
158 | return value;
159 | }
160 |
161 | private Function parseMethod(Type type, boolean declaredVoid) {
162 | Function method = new Function();
163 | method.setDeclaredVoid(declaredVoid);
164 | method.setType(loader.getSimpleCallableReturnType(type));
165 | while (lexer.lookingAt(LEFT_PAREN)) {
166 | method.addParameterList(parseNameList(type, method));
167 | type = loader.getSimpleCallableReturnType(type);
168 | }
169 | return method;
170 | }
171 |
172 | }
173 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/ParameterNameParserException.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | @SuppressWarnings("serial")
4 | class ParameterNameParserException extends RuntimeException {
5 |
6 | public ParameterNameParserException(String message) {
7 | super(message);
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/SimpleReflType.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | import javax.lang.model.type.TypeKind;
7 |
8 | import com.redhat.ceylon.model.loader.mirror.ClassMirror;
9 | import com.redhat.ceylon.model.loader.mirror.TypeMirror;
10 | import com.redhat.ceylon.model.loader.mirror.TypeParameterMirror;
11 |
12 | /**
13 | * Simple Type Mirror.
14 | *
15 | * @author Stéphane Épardaud
16 | */
17 | public class SimpleReflType implements TypeMirror {
18 |
19 | public enum Module {
20 | CEYLON, JDK;
21 | }
22 |
23 | private String name;
24 | private TypeKind kind;
25 | private TypeMirror[] typeParameters;
26 | private Module module;
27 |
28 | public SimpleReflType(String name, Module module, TypeKind kind, TypeMirror... typeParameters) {
29 | this.name = name;
30 | this.kind = kind;
31 | this.typeParameters = typeParameters;
32 | this.module = module;
33 | }
34 |
35 | public String toString() {
36 | String p = Arrays.toString(typeParameters);
37 | return getClass().getSimpleName() + " of " + name + "<" + p.substring(1, p.length()-1) + ">";
38 | }
39 |
40 | @Override
41 | public String getQualifiedName() {
42 | return name;
43 | }
44 |
45 | @Override
46 | public List getTypeArguments() {
47 | return Arrays.asList(typeParameters);
48 | }
49 |
50 | @Override
51 | public TypeKind getKind() {
52 | return kind;
53 | }
54 |
55 | @Override
56 | public TypeMirror getComponentType() {
57 | return null;
58 | }
59 |
60 | @Override
61 | public boolean isPrimitive() {
62 | return kind.isPrimitive();
63 | }
64 |
65 | @Override
66 | public TypeMirror getUpperBound() {
67 | return null;
68 | }
69 |
70 | @Override
71 | public TypeMirror getLowerBound() {
72 | return null;
73 | }
74 |
75 | @Override
76 | public boolean isRaw() {
77 | return false;
78 | }
79 |
80 | @Override
81 | public ClassMirror getDeclaredClass() {
82 | return null;
83 | }
84 |
85 | public Module getModule() {
86 | return module;
87 | }
88 |
89 | @Override
90 | public TypeParameterMirror getTypeParameter() {
91 | return null;
92 | }
93 |
94 | @Override
95 | public TypeMirror getQualifyingType() {
96 | return null;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/Timer.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | import java.io.PrintWriter;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | public class Timer {
8 | private long programStart;
9 | private String currentTask;
10 | private long currentTaskStart;
11 | protected boolean verbose;
12 | private final Map ignoredCategories;
13 | protected PrintWriter out;
14 |
15 | protected Timer(){
16 | ignoredCategories = new HashMap();
17 | }
18 |
19 | private Timer(PrintWriter out, long programStart, boolean verbose, Map ignoredCategories) {
20 | this.programStart = programStart;
21 | this.verbose = verbose;
22 | this.ignoredCategories = ignoredCategories;
23 | this.out = out;
24 | }
25 |
26 | public Timer(boolean verbose) {
27 | ignoredCategories = new HashMap();
28 | setup(verbose);
29 | }
30 |
31 | private void setup(boolean verbose) {
32 | // we delay printing the program start because we don't know if the verbose option is set yet at
33 | // that time, so we fake it later on with the correct time
34 | }
35 |
36 | /**
37 | * Initializes this timer and {@linkplain #log(String) logs} a
38 | * "program start" message.
39 | */
40 | public void init(){
41 | programStart = System.nanoTime();
42 | if(verbose)
43 | log("Program start", programStart);
44 | }
45 |
46 | public void end() {
47 | if(!verbose)
48 | return;
49 | log("Program end");
50 | }
51 |
52 | /**
53 | * {@linkplain #endTask() Ends} the current task (if any) and starts a
54 | * timed task with the given name,
55 | * {@linkplain #log(String) logging} the task name.
56 | *
57 | * @param name The name of the task to start.
58 | *
59 | * @see #nestedTimer()
60 | */
61 | public void startTask(String name){
62 | if(!verbose)
63 | return;
64 | if(currentTask != null)
65 | endTask();
66 | currentTask = name;
67 | currentTaskStart = System.nanoTime();
68 | log("Task "+currentTask+" start");
69 | }
70 |
71 | /**
72 | * Logs a message, including the elapsed time since this Timer was
73 | * {@linkplain #init() initialized}.
74 | * @param string The message
75 | */
76 | public void log(String string) {
77 | if(!verbose)
78 | return;
79 | log(string, System.nanoTime());
80 | }
81 |
82 | private void log(String string, long now) {
83 | long delta = (now - programStart)/1_000_000;
84 | String msg = "["+delta+"ms] "+string;
85 | if(out != null)
86 | out.println(msg);
87 | else
88 | System.err.println(msg);
89 | }
90 |
91 | /**
92 | * Prints a message
93 | * @param string The message
94 | */
95 | public void print(String string) {
96 | if(!verbose)
97 | return;
98 | if(out != null)
99 | out.println(string);
100 | else
101 | System.err.println(string);
102 | }
103 |
104 | /**
105 | * Ends the current task, {@linkplain #log(String) logging} the name of
106 | * the task and its elapsed time
107 | * @see #startTask(String)
108 | */
109 | public void endTask() {
110 | if(!verbose)
111 | return;
112 | long time = System.nanoTime();
113 | long delta = (time - currentTaskStart)/1_000_000L;
114 | log("Task "+currentTask+" end: "+delta+"ms");
115 | printIgnoredCategories();
116 | currentTask = null;
117 | }
118 |
119 | public void startIgnore(String category) {
120 | if(!verbose)
121 | return;
122 | IgnoredCategory ignoredCategory = ignoredCategories.get(category);
123 | if(ignoredCategory == null){
124 | ignoredCategory = new IgnoredCategory(category);
125 | ignoredCategories.put(category, ignoredCategory);
126 | }
127 | ignoredCategory.start();
128 | }
129 |
130 | public void stopIgnore(String category) {
131 | if(!verbose)
132 | return;
133 | IgnoredCategory ignoredCategory = ignoredCategories.get(category);
134 | if (ignoredCategory != null) {
135 | ignoredCategory.stop();
136 | }
137 | }
138 |
139 | private void printIgnoredCategories(){
140 | for(IgnoredCategory category : ignoredCategories.values()){
141 | if(category.total != 0){
142 | print(" Including "+category.name+" for "+category.total+"ms");
143 | }
144 | category.reset();
145 | }
146 | }
147 |
148 | private final class IgnoredCategory {
149 | String name;
150 | long start;
151 | long total;
152 | int count;
153 | public IgnoredCategory(String category) {
154 | this.name = category;
155 | }
156 | public void start() {
157 | if(count++ == 0){
158 | start = System.nanoTime();
159 | }
160 | }
161 | public void stop() {
162 | if(--count == 0){
163 | long end = System.nanoTime();
164 | long delta = (end - start)/1_000_000;
165 | total += delta;
166 | }
167 | }
168 | public void reset() {
169 | if(count != 0)
170 | print("Ignored category "+name+" count is "+count+" during reset: timings will be wrong");
171 | // try to fix it for next time?
172 | count = 0;
173 | total = 0;
174 | }
175 | }
176 |
177 | /**
178 | * Creates and returns a new timer suitable for timing sub-tasks
179 | * without stopping the 'outer' timer. Necessary because
180 | * {@link #startTask(String)} stops the current timer.
181 | * @return The new timer
182 | */
183 | public Timer nestedTimer() {
184 | return new Timer(out, programStart, verbose, ignoredCategories);
185 | }
186 | }
187 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/TypeParserException.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader;
2 |
3 | @SuppressWarnings("serial")
4 | public class TypeParserException extends RuntimeException {
5 |
6 | public TypeParserException(String message) {
7 | super(message);
8 | }
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/impl/reflect/ReflectionModelLoader.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader.impl.reflect;
2 |
3 | import java.lang.reflect.Member;
4 | import java.util.List;
5 |
6 | import com.redhat.ceylon.common.JVMModuleUtil;
7 | import com.redhat.ceylon.common.log.Logger;
8 | import com.redhat.ceylon.model.loader.AbstractModelLoader;
9 | import com.redhat.ceylon.model.loader.Timer;
10 | import com.redhat.ceylon.model.loader.TypeParser;
11 | import com.redhat.ceylon.model.loader.impl.reflect.mirror.ReflectionClass;
12 | import com.redhat.ceylon.model.loader.impl.reflect.mirror.ReflectionMethod;
13 | import com.redhat.ceylon.model.loader.mirror.ClassMirror;
14 | import com.redhat.ceylon.model.loader.mirror.MethodMirror;
15 | import com.redhat.ceylon.model.typechecker.model.Module;
16 | import com.redhat.ceylon.model.typechecker.model.Modules;
17 | import com.redhat.ceylon.model.typechecker.model.Unit;
18 | import com.redhat.ceylon.model.typechecker.util.ModuleManager;
19 |
20 | /**
21 | * A model loader which uses Java reflection.
22 | *
23 | * @author Stéphane Épardaud
24 | */
25 | public abstract class ReflectionModelLoader extends AbstractModelLoader {
26 | protected Logger log;
27 |
28 | public ReflectionModelLoader(ModuleManager moduleManager, Modules modules, Logger log){
29 | this.moduleManager = moduleManager;
30 | this.modules = modules;
31 | this.typeFactory = new Unit();
32 | this.typeParser = new TypeParser(this);
33 | this.timer = new Timer(false);
34 | this.log = log;
35 | }
36 |
37 | protected abstract List getPackageList(Module module, String packageName);
38 | protected abstract boolean packageExists(Module module, String packageName);
39 | protected abstract Class> loadClass(Module module, String name);
40 |
41 | @Override
42 | public void loadStandardModules() {
43 | super.loadStandardModules();
44 | // load two packages for the language module
45 | Module languageModule = modules.getLanguageModule();
46 | findOrCreatePackage(languageModule, AbstractModelLoader.CEYLON_LANGUAGE);
47 | findOrCreatePackage(languageModule, AbstractModelLoader.CEYLON_LANGUAGE_MODEL);
48 | findOrCreatePackage(languageModule, AbstractModelLoader.CEYLON_LANGUAGE_MODEL_DECLARATION);
49 | findOrCreatePackage(languageModule, AbstractModelLoader.CEYLON_LANGUAGE_SERIALIZATION);
50 | }
51 |
52 | @Override
53 | public boolean loadPackage(Module module, String packageName, boolean loadDeclarations) {
54 | // abort if we already loaded it, but only record that we loaded it if we want
55 | // to load the declarations, because merely calling complete() on the package
56 | // is OK
57 | packageName = JVMModuleUtil.quoteJavaKeywords(packageName);
58 | if(loadDeclarations && !loadedPackages.add(cacheKeyByModule(module, packageName))){
59 | return true;
60 | }
61 | if(!packageExists(module, packageName))
62 | return false;
63 | if(loadDeclarations){
64 | for(String file : getPackageList(module, packageName)){
65 | // ignore non-class stuff
66 | if(!file.toLowerCase().endsWith(".class"))
67 | continue;
68 | // turn it into a class name
69 | // FIXME: this is terrible
70 | String className = file.substring(0, file.length()-6).replace('/', '.');
71 | // get the last part
72 | int lastDot = className.lastIndexOf('.');
73 | String lastPart = lastDot == -1 ? className : className.substring(lastDot+1);
74 | int dollar = lastPart.indexOf('$');
75 | // if we have a dollar after the first char (where it would be quoting), skip it
76 | // because those are local/member/anonymous/impl ones
77 | if(dollar > 0)
78 | continue;
79 | // skip module/package declarations too (do not strip before checking)
80 | if(isModuleOrPackageDescriptorName(lastPart))
81 | continue;
82 |
83 | // the logic for lower-cased names should be abstracted somewhere sane
84 | if(!isLoadedFromSource(className)
85 | && (!className.endsWith("_") || !isLoadedFromSource(className.substring(0, className.length()-1)))
86 | && !isTypeHidden(module, className))
87 | convertToDeclaration(module, className, DeclarationType.TYPE);
88 | }
89 | if(module.getNameAsString().equals(JAVA_BASE_MODULE_NAME)
90 | && packageName.equals("java.lang"))
91 | loadJavaBaseArrays();
92 | }
93 | return true;
94 | }
95 |
96 | protected boolean isLoadedFromSource(String className) {
97 | return false;
98 | }
99 |
100 | @Override
101 | public ClassMirror lookupNewClassMirror(Module module, String name) {
102 | Class> klass = null;
103 | // first try with the same name, for Java interop with classes with lowercase name
104 | klass = loadClass(module, JVMModuleUtil.quoteJavaKeywords(name));
105 | if (klass == null && lastPartHasLowerInitial(name) && !name.endsWith("_")) {
106 | klass = loadClass(module, JVMModuleUtil.quoteJavaKeywords(name+"_"));
107 | }
108 | return klass != null ? new ReflectionClass(klass) : null;
109 | }
110 |
111 | @Override
112 | protected String assembleJavaClass(String javaClass, String packageName) {
113 | // strip the java class name of its package part
114 | if(!packageName.isEmpty())
115 | javaClass = javaClass.substring(packageName.length()+1); // pkg + dot
116 | // now replace every dot in the name part with $
117 | javaClass = javaClass.replace('.', '$');
118 | // assemble back
119 | if(packageName.isEmpty())
120 | return javaClass;
121 | return packageName + "." + javaClass;
122 | }
123 |
124 | @Override
125 | protected boolean isOverridingMethod(MethodMirror methodSymbol) {
126 | final Member method = ((ReflectionMethod)methodSymbol).method;
127 | if (method.getDeclaringClass().getName().contentEquals("ceylon.language.Identifiable")) {
128 | if (method.getName().contentEquals("equals") || method.getName().contentEquals("hashCode")) {
129 | return true;
130 | }
131 | }
132 | if (method.getDeclaringClass().getName().contentEquals("ceylon.language.Object")) {
133 | if (method.getName().contentEquals("equals") || method.getName().contentEquals("hashCode") || method.getName().contentEquals("toString")) {
134 | return false;
135 | }
136 | }
137 | return ((ReflectionMethod)methodSymbol).isOverridingMethod();
138 | }
139 |
140 | @Override
141 | protected boolean isOverloadingMethod(MethodMirror methodSymbol) {
142 | return ((ReflectionMethod)methodSymbol).isOverloadingMethod();
143 | }
144 |
145 | @Override
146 | protected void logError(String message) {
147 | log.error(message);
148 | }
149 |
150 | @Override
151 | protected void logWarning(String message) {
152 | log.warning(message);
153 | }
154 |
155 | @Override
156 | protected void logVerbose(String message) {
157 | log.debug(message);
158 | }
159 |
160 | }
161 |
--------------------------------------------------------------------------------
/src/com/redhat/ceylon/model/loader/impl/reflect/mirror/ReflectionAnnotation.java:
--------------------------------------------------------------------------------
1 | package com.redhat.ceylon.model.loader.impl.reflect.mirror;
2 |
3 | import java.lang.annotation.Annotation;
4 | import java.lang.reflect.Method;
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 | import com.redhat.ceylon.model.loader.mirror.AnnotationMirror;
9 |
10 | public class ReflectionAnnotation implements AnnotationMirror {
11 |
12 | private Annotation annotation;
13 |
14 | public ReflectionAnnotation(Annotation annotation) {
15 | this.annotation = annotation;
16 | }
17 |
18 | @Override
19 | public Object getValue(String fieldName) {
20 | try {
21 | Method method = annotation.getClass().getMethod(fieldName);
22 | return convertValue(method.invoke(annotation));
23 | } catch (Exception e) {
24 | e.printStackTrace();
25 | return null;
26 | }
27 | }
28 |
29 | private Object convertValue(Object value) {
30 | Class extends Object> valueClass = value.getClass();
31 | if(valueClass.isArray()){
32 | if (valueClass.getComponentType().isPrimitive()) {
33 | Class> componentType = valueClass.getComponentType();
34 | if (componentType == short.class) {
35 | short[] array = (short[])value;
36 | List