package-info

PACKAGE-INFO.JAVA 作用及用法详解

安稳与你 提交于 2020-04-17 04:01:32
【推荐阅读】微服务还能火多久?>>> package-info.java对于经常使用外部包的程序员来说应该是熟悉陌生人。因为不是专门开发包的程序员很少需要关注它,而又常在其他包中看到他,眼很熟。它到底有哪些特性和作用及如何使用呢?程序员讲究动口不如动手,何不创建一个试试。打开Eclipse,new class,哦!创建失败,‘-’ 作为特殊字符不允许在类名称里出现,什么情况。原来它本来就是个特例当然得用特别方法创建,记事本上,好了成功了。我喜欢追根问底,还什么特殊的,google 吧,果然有先辈,转过来收藏了。 原文地址:http://strong-life-126-com.iteye.com/blog/806246 特点: 首先,它不能随便被创建。 在Eclipse中,package-info文件不能随便被创建,会报“Type name is notvalid”错误,类名无效,Java变量定义规范是:字母、数字、下划线,还有那个不怎么常用的$符号(顺带说下,Java是支持中文名称的变量,习惯挑战的同学可以尝试下,分享一下这方面的经验)。 其次,服务的对象很特殊。 一个类是一类或一组事物的描述,比如Dog这个类,就是描述旺财的,那package-info这个类是描述啥的呢?它总要有一个被描述或被陈述的对象,它是描述和记录本包信息。 最后,类不能带有public

Spring boot, runnable jar can't load package-info.class

▼魔方 西西 提交于 2019-12-25 16:57:55
问题 We use Spring boot with hibernate database mapping. The entities contains JSON columns mapped as a customized types defined using package-info.java file. When we run the spring-project from Eclipse IDE everything is ok and we can call our web services. When we generate an executable jar and we try to call our web services the following error is raised : mai 04, 2017 1:35:00 PM org.apache.catalina.core.StandardWrapperValve invoke GRAVE: Servlet.service() for servlet [dispatcherServlet] in

Why does the package-info.java file affect annotation-processing?

那年仲夏 提交于 2019-12-23 05:16:36
问题 Adding a package-info.java file to the project, causes annotation-processors to create different output. I don't understand why this happens. I think adding the package-info.java file should not affect my build at all, because it does not contain any fancy stuff (like Annotations, etc.). It only contains the simplest package declaration: package com.example; I've managed to create a minimal project to reproduce the issue with javac only. The project has too much code to post here on

Immutables-library generates the same immutable class twice

安稳与你 提交于 2019-12-22 11:33:47
问题 When using the immutables.io annotation processor in a multi-module android app, the build fails, when a package-info.java file is used. I've managed to build a minimal test-project on GitHub to reproduce the issue: ImmutablesPackageInfoIssue The project consists of 2 modules: app: android application: @Value.Immutable is used in AndroidIm.java lib: java module: @Value.Immutable is used in JavaIm.java So basically, using immutables.io in both modules works fine. But when we add a package-info

Error message not going away in Netbeans, why? “java.net.BindException: Address already in use: bind”

三世轮回 提交于 2019-12-12 00:10:04
问题 It seems like a duplicate question of how to kill a process already running on that port, but it is a different question. When I killed the process and restart it, it still gives me that error message, seems like Netbeans has a problem, and the error message got stuck and keeps appearing even when the port is not in use. I've used the tool at : http://www.yougetsignal.com/tools/open-ports/ to check the port : 6600 Here is what it says : My code looks like the following : import java.io.*;

Is there a way to create package-info.java for existing packages in one move in eclipse?

冷暖自知 提交于 2019-12-10 14:24:12
问题 I have some legacy packages which doesn't have package-info.java . For some reason I need to create package-info.javas for them and I found the task really boring because there is no shortcut in eclipse for me to do that. I have to manually use the New > File procedure to create the file, then manually type in those package names. Is there a shortcut in eclipse for such task? 回答1: There is no easy way to do this as far as I know, at least "the right way." What you can do as a shortcut is

Immutables-library generates the same immutable class twice

谁说胖子不能爱 提交于 2019-12-06 13:22:13
When using the immutables.io annotation processor in a multi-module android app, the build fails, when a package-info.java file is used. I've managed to build a minimal test-project on GitHub to reproduce the issue: ImmutablesPackageInfoIssue The project consists of 2 modules: app: android application: @Value.Immutable is used in AndroidIm.java lib: java module: @Value.Immutable is used in JavaIm.java So basically, using immutables.io in both modules works fine. But when we add a package-info.java file (to the com.example package in the app module), the compilation fails with this error: com

Android SDK 28 - versionCode in PackageInfo has been deprecated

ε祈祈猫儿з 提交于 2019-12-01 14:59:05
I just upgraded my app's compileSdkVersion to 28 (Pie). I'm getting a compilation warning: warning: [deprecation] versionCode in PackageInfo has been deprecated The warning is coming from this code: final PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); int versionCode = info.versionCode; I looked at the documentation , but it doesn't say anything about how to resolve this issue or what should be used instead of the deprecated field. It says what to do on the Java doc (I recommend not using the Kotlin documentation for much; it's not really maintained

Android SDK 28 - versionCode in PackageInfo has been deprecated

Deadly 提交于 2019-11-30 21:40:59
问题 I just upgraded my app's compileSdkVersion to 28 (Pie). I'm getting a compilation warning: warning: [deprecation] versionCode in PackageInfo has been deprecated The warning is coming from this code: final PackageInfo info = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); int versionCode = info.versionCode; I looked at the documentation, but it doesn't say anything about how to resolve this issue or what should be used instead of the deprecated field. 回答1: It says what