Skip to content
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

Separate the language model to a dedicated module #553

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions api/pom.xml
Expand Up @@ -155,6 +155,12 @@
<version>6.8.8</version>
</dependency>

<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.lang-model</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
Expand Down Expand Up @@ -189,6 +195,11 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.lang-model</artifactId>
</dependency>

<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
Expand Down
112 changes: 112 additions & 0 deletions lang-model/pom.xml
@@ -0,0 +1,112 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-parent</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>jakarta.enterprise.lang-model</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to prepend jakarta.enterprise?
Just having lang-model sounds a lot better to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at Maven Central, you'll find both jakarta.enterprise:cdi-api and jakarta.enterprise:jakarta.enterprise.cdi-api. I don't know if that was a mistake or not, but it seems that the shorter form was considered and rejected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that but TBF I don't know what the history was. I just thought it would be more readable the shorter it is.

<packaging>jar</packaging>

<name>CDI Language Model</name>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we want to make this potentially usable elsewhere, I'd say it is just Language Model Abstraction

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to avoid something like "Jakarta Language Model", because that's not what it is at the moment, and just "Language Model" seems strange. I attribute this to CDI on a few places, but it's worded in a way that generalizing to Jakarta should be straightforward (if that's what it ends up being).

<description>Build Compatible (Reflection-Free) Java Language Model for CDI</description>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, would drop CDI. Alternatively, change the wording to say that CDI is an example of framework leveraging this language model?


<licenses>
<license>
<name>Apache License 2.0</name>
<url>https://repository.jboss.org/licenses/apache-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven-bundle-plugin.version>2.5.4</maven-bundle-plugin.version>
<maven-javadoc-plugin>3.2.0</maven-javadoc-plugin>
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<resources>
<resource>
<directory>${project.basedir}/..</directory>
<includes>
<include>LICENSE.txt</include>
<include>NOTICE.md</include>
</includes>
<targetPath>META-INF</targetPath>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven-bundle-plugin.version}</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Export-Package>
jakarta.enterprise.lang.model.*;version=4.0,
</Export-Package>
</instructions>
</configuration>
</plugin>
<!-- Add the OSGi Manifest to the main jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin}</version>
<configuration>
<docfilessubdirs>true</docfilessubdirs>
<description>Jakarta CDI Language Model</description>
<doctitle>Jakarta CDI Language Model</doctitle>
<windowtitle>Jakarta CDI Language Model</windowtitle>
<header><![CDATA[<br>Jakarta CDI Language Model ${project.version}]]>
</header>
<bottom><![CDATA[
Comments to: <a href="mailto:cdi-dev@eclipse.org">cdi-dev@eclipse.org</a>.<br>
Copyright &#169; 2018,2020 Eclipse Foundation.<br>
Use is subject to <a href="{@docRoot}/doc-files/speclicense.html" target="_top">license terms</a>.]]>
</bottom>
</configuration>

<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
Expand Up @@ -9,7 +9,7 @@
*
* <ul>
* <li>{@linkplain PackageInfo packages}</li>
* <li>{@linkplain ClassInfo classes}, including interfaces, enums, and annotations</li>
* <li>{@linkplain ClassInfo classes}, including interfaces, enums, annotations, and records</li>
* <li>{@linkplain FieldInfo fields}</li>
* <li>{@linkplain MethodInfo methods}, including constructors</li>
* <li>{@linkplain ParameterInfo method parameters}, including constructor parameters</li>
Expand Down
@@ -0,0 +1,4 @@
/**
* Interfaces that represent {@linkplain jakarta.enterprise.lang.model.declarations.DeclarationInfo declarations}.
*/
package jakarta.enterprise.lang.model.declarations;
@@ -0,0 +1,6 @@
/**
* The core interfaces of the language model that represent
* {@linkplain jakarta.enterprise.lang.model.AnnotationInfo annotations} and
* {@linkplain jakarta.enterprise.lang.model.AnnotationTarget annotation targets}.
*/
package jakarta.enterprise.lang.model;
Expand Up @@ -3,7 +3,7 @@
import jakarta.enterprise.lang.model.declarations.ClassInfo;

/**
* A class type, including interface types, enum types and annotation types.
* A class type, including interface types, enum types, annotation types and record types.
* Class types are introduced by class {@linkplain #declaration() declarations}.
*
* @since 4.0
Expand Down
Expand Up @@ -68,8 +68,8 @@ enum Kind {
/** E.g. when method returns {@code T} and {@code T} is a type parameter of the declaring class. */
TYPE_VARIABLE,
/**
* E.g. when method returns {@code List<? extends Number>}. On the first level, we have a {@code PARAMETERIZED_TYPE},
* but on the second level, the first (and only) type argument is a {@code WILDCARD_TYPE}.
* E.g. when method returns {@code List<? extends Number>}. The kind of such type is {@code PARAMETERIZED_TYPE},
* but the first (and only) type argument is a {@code WILDCARD_TYPE}.
*/
WILDCARD_TYPE,
}
Expand Down
@@ -0,0 +1,4 @@
/**
* Interfaces that represent {@linkplain jakarta.enterprise.lang.model.types.Type types}.
*/
package jakarta.enterprise.lang.model.types;
72 changes: 72 additions & 0 deletions lang-model/src/main/javadoc/doc-files/speclicense.html
@@ -0,0 +1,72 @@
<html>
<head>
<title>Eclipse Foundation Specification License - v1.0</title>
</head>
<body>
<h1>Eclipse Foundation Specification License - v1.0</h1>
<p>By using and/or copying this document, or the Eclipse Foundation
document from which this statement is linked, you (the licensee) agree
that you have read, understood, and will comply with the following
terms and conditions:</p>

<p>Permission to copy, and distribute the contents of this document, or
the Eclipse Foundation document from which this statement is linked, in
any medium for any purpose and without fee or royalty is hereby
granted, provided that you include the following on ALL copies of the
document, or portions thereof, that you use:</p>

<ul>
<li> link or URL to the original Eclipse Foundation document.</li>
<li>All existing copyright notices, or if one does not exist, a notice
(hypertext is preferred, but a textual representation is permitted)
of the form: &quot;Copyright &copy; [$date-of-document]
&ldquo;Eclipse Foundation, Inc. &lt;&lt;url to this license&gt;&gt;
&quot;
</li>
</ul>

<p>Inclusion of the full text of this NOTICE must be provided. We
request that authorship attribution be provided in any software,
documents, or other items or products that you create pursuant to the
implementation of the contents of this document, or any portion
thereof.</p>

<p>No right to create modifications or derivatives of Eclipse Foundation
documents is granted pursuant to this license, except anyone may
prepare and distribute derivative works and portions of this document
in software that implements the specification, in supporting materials
accompanying such software, and in documentation of such software,
PROVIDED that all such works include the notice below. HOWEVER, the
publication of derivative works of this document for use as a technical
specification is expressly prohibited.</p>

<p>The notice is:</p>

<p>&quot;Copyright &copy; 2018 Eclipse Foundation. This software or
document includes material copied from or derived from [title and URI
of the Eclipse Foundation specification document].&quot;</p>

<h2>Disclaimers</h2>

<p>THIS DOCUMENT IS PROVIDED &quot;AS IS,&quot; AND THE COPYRIGHT
HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE
SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS
WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR
OTHER RIGHTS.</p>

<p>THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE
FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT
OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE
CONTENTS THEREOF.</p>

<p>The name and trademarks of the copyright holders or the Eclipse
Foundation may NOT be used in advertising or publicity pertaining to
this document or its contents without specific, written prior
permission. Title to copyright in this document will at all times
remain with copyright holders.</p>

</body>
</html>
22 changes: 22 additions & 0 deletions lang-model/src/main/javadoc/overview.html
@@ -0,0 +1,22 @@
<html>

<body>

<p>The language model for CDI provides a reflection-free model of the Java language.
It allows inspecting the high-level structure of programs without having to load
any of their classes or instantiate any of the present annotations.</p>

<p>The root interface {@link jakarta.enterprise.lang.model.AnnotationTarget AnnotationTarget}
represents anything that can be {@linkplain jakarta.enterprise.lang.model.AnnotationInfo annotated}.
Two kinds of annotation targets are distinguished:</p>

<ul>
<li>{@linkplain jakarta.enterprise.lang.model.declarations.DeclarationInfo declarations}</li>
<li>{@linkplain jakarta.enterprise.lang.model.types.Type types}</li>
</ul>

<p>Structure of declarations and types may be further inspected.</p>

</body>

</html>
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -31,6 +31,7 @@

<modules>
<module>spec</module>
<module>lang-model</module>
<module>api</module>
</modules>
<build>
Expand Down