Coder Social home page Coder Social logo

colesico / colesico-framework Goto Github PK

View Code? Open in Web Editor NEW
15.0 0.0 4.0 5.12 MB

Micro framework for creating server side applications in Java 17+

License: Apache License 2.0

Java 99.90% Shell 0.10%
java lightweight full-stack micro-framework dependency-injection rest-api plugin-system microservices

colesico-framework's People

Contributors

colesico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colesico-framework's Issues

Add GraalVM support

Examples:
https://docs.micronaut.io/latest/guide/index.html#graal
https://quarkus.io/guides/writing-native-applications-tips

  1. Test all modules for compatibility with graalvm native, where need to add graal configuration files (reflection.json etc)

  2. Introduce new module clasico-introspect for common purpose class introspection (to analyze classes without reflection)
    Add generic annotations Introspect and IntrospectClasses () to specify a classes for introspection classes generattion

  3. Add an annotation processor (In a separate new module colesico-graalvm ) for processing these annotations to generate auxiliary configuration files (reflection.json etc)

Eclipse ADT Compilation Error

Hi,

I can't use colesico-ioc ADT processor. It works with maven from command line but not with Eclipse 2020-06
Java Version: 14

pom.xml

<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>
	<groupId>net.colesico.framework.example</groupId>
	<artifactId>ioc-example</artifactId>
	<version>3.9.0</version>
	<packaging>jar</packaging>
	<name>Colesico example - IoC</name>
	<properties>
	</properties>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>net.colesico.framework</groupId>
			<artifactId>colesico-ioc</artifactId>
			<version>3.9.0</version>
			<exclusions>
				<exclusion>
					<groupId>com.squareup</groupId>
					<artifactId>javapoet</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.apache.commons</groupId>
					<artifactId>commons-lang3</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<release>12</release>
					<showWarnings>true</showWarnings>
					<showDeprecation>true</showDeprecation>
					<annotationProcessorPaths>
						<path>
							<groupId>net.colesico.framework</groupId>
							<artifactId>colesico-ioc</artifactId>
							<version>${project.version}</version>
						</path>
						<dependency>
							<groupId>org.slf4j</groupId>
							<artifactId>slf4j-simple</artifactId>
							<version>1.7.30</version>
						</dependency>
						<dependency>
							<groupId>org.slf4j</groupId>
							<artifactId>slf4j-api</artifactId>
							<version>1.7.30</version>
						</dependency>
						<dependency>
							<groupId>com.squareup</groupId>
							<artifactId>javapoet</artifactId>
							<version>1.13.0</version>
						</dependency>
					</annotationProcessorPaths>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Eclipse Error message:

java.lang.Exception: Resource '/ioc-example/target/generated-sources/annotations/package colesico/framework/example/ioc/helloworld' does not exist.
	at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
	at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:330)
	at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:204)
	at org.eclipse.core.internal.resources.Resource.setDerived(Resource.java:1614)
	at org.eclipse.jdt.apt.core.internal.generatedfile.GeneratedFileManager.generateFileDuringBuild(GeneratedFileManager.java:540)
	at org.eclipse.jdt.internal.apt.pluggable.core.filer.IdeJavaSourceOutputStream.close(IdeJavaSourceOutputStream.java:71)
	at java.base/sun.nio.cs.StreamEncoder.implClose(StreamEncoder.java:353)
	at java.base/sun.nio.cs.StreamEncoder.close(StreamEncoder.java:168)
	at java.base/java.io.OutputStreamWriter.close(OutputStreamWriter.java:255)
	at java.base/java.io.BufferedWriter.close(BufferedWriter.java:269)
	at java.base/java.io.PrintWriter.close(PrintWriter.java:415)
	at java.base/java.io.BufferedWriter.close(BufferedWriter.java:269)
	at colesico.framework.assist.codegen.CodegenUtils.createJavaFile(CodegenUtils.java:65)
	at colesico.framework.ioc.codegen.parser.ProducersProcessor.generateIoclet(ProducersProcessor.java:115)
	at colesico.framework.ioc.codegen.parser.ProducersProcessor.process(ProducersProcessor.java:102)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.handleProcessor(RoundDispatcher.java:142)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.RoundDispatcher.round(RoundDispatcher.java:113)
	at org.eclipse.jdt.internal.compiler.apt.dispatch.BaseAnnotationProcessorManager.processAnnotations(BaseAnnotationProcessorManager.java:171)
	at org.eclipse.jdt.internal.apt.pluggable.core.dispatch.IdeAnnotationProcessorManager.processAnnotations(IdeAnnotationProcessorManager.java:138)
	at org.eclipse.jdt.internal.compiler.Compiler.processAnnotationsInternal(Compiler.java:996)
	at org.eclipse.jdt.internal.compiler.Compiler.processAnnotations(Compiler.java:932)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:450)
	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:386)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:214)
	at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:318)
	at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:79)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:275)
	at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:187)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:832)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:316)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:319)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:371)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:392)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Eclipse ADT Incorrect Code Generation

Hi,

I tested with the latest patch #2, exception does not thrown any more.
But simple ioc test does not work from Eclipse but works if i compile with maven.
Eclipse generate incorrect HelloIoclet.addFactories() method.

Here is the diff report that compares generated code for Eclipse and Maven.

--- C:\eclipse-2020\workspace\test\src\test\java\colesico\framework\example\ioc\helloworld\HelloIocletMaven.java	2020-08-27 10:08:50.000000000 +0300
+++ C:\eclipse-2020\workspace\test\src\test\java\colesico\framework\example\ioc\helloworld\HelloIocletEclipse.java	2020-08-27 10:08:48.000000000 +0300
@@ -1,27 +1,28 @@
 // This is automatically generated file. Do not modify!
 package colesico.framework.example.ioc.helloworld;
 
-//This is automatically generated file. Do not modify!
+// This is automatically generated file. Do not modify!
 
 import colesico.framework.assist.LazySingleton;
 import colesico.framework.assist.codegen.Genstamp;
 import colesico.framework.ioc.ioclet.AdvancedIoc;
 import colesico.framework.ioc.ioclet.Catalog;
 import colesico.framework.ioc.ioclet.Factory;
 import colesico.framework.ioc.ioclet.Ioclet;
+import colesico.framework.ioc.key.ClassedKey;
 import colesico.framework.ioc.key.TypeKey;
 import colesico.framework.ioc.production.InstanceProducingException;
 
 @Genstamp(
         generator = "colesico.framework.ioc.codegen.generator.IocletGenerator",
-        timestamp = "2020-08-27T10:04:22.886Z",
-        hashId = "60b88a01-4283-40a1-a7e5-d37548b515b3",
+        timestamp = "2020-08-27T10:04:50.080Z",
+        hashId = "340940d7-f873-4647-9d57-08f86eb18dfc",
         comments = "Producer: ClassElement{originElement=colesico.framework.example.ioc.helloworld.HelloProducer}"
 )
-public final class HelloIocletMaven implements Ioclet {
+public final class HelloIocletEclipse implements Ioclet {
     private final LazySingleton<HelloProducer> producer = new LazySingleton<HelloProducer>() {
         @Override
         public final HelloProducer create() {
             return new HelloProducer();
         }
     };
@@ -31,12 +32,13 @@
         return "colesico.framework.example.ioc.helloworld.HelloProducer";
     }
 
     /**
      * Factory to produce colesico.framework.example.ioc.helloworld.HelloBean class instance
      * Scope: UNSCOPED; Custom: null
+     * Classed: java.lang.Class
      */
     public Factory<HelloBean> getHelloBeanFactory0() {
         return new Factory<HelloBean>() {
             @Override
             public final void setup(final AdvancedIoc ioc) {
                 // Initialize dependencies for: colesico.framework.example.ioc.helloworld.HelloBean
@@ -58,12 +60,13 @@
         };
     }
 
     /**
      * Factory to produce colesico.framework.example.ioc.helloworld.MainBeanHWD class instance
      * Scope: UNSCOPED; Custom: null
+     * Classed: java.lang.Class
      */
     public Factory<MainBeanHWD> getMainBeanHWDFactory1() {
         return new Factory<MainBeanHWD>() {
             private Factory<HelloBean> helloServiceFac;
 
             @Override
@@ -87,16 +90,16 @@
             }
         };
     }
 
     @Override
     public final void addFactories(final Catalog catalog) {
-        if(catalog.accept(new TypeKey("colesico.framework.example.ioc.helloworld.HelloBean"), null, null, false)){
+        if(catalog.accept(new ClassedKey("colesico.framework.example.ioc.helloworld.HelloBean","java.lang.Class"), null, null, false)){
             catalog.add(getHelloBeanFactory0());
         }
 
-        if(catalog.accept(new TypeKey("colesico.framework.example.ioc.helloworld.MainBeanHWD"), null, null, false)){
+        if(catalog.accept(new ClassedKey("colesico.framework.example.ioc.helloworld.MainBeanHWD","java.lang.Class"), null, null, false)){
             catalog.add(getMainBeanHWDFactory1());
         }
 
     }
 }

I debug IocletGenerator.generateAddFactoriesMethod() method and if (factoryElm.getCondition() != null) { condition does not satify for the Eclipse.

eclipse-debug-2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.