我需要使用方法参数名编译我的应用程序,以便SpEL
(Spring Expression Language)工作。
我使用Ant的javac
任务启用调试信息,如下所示
<javac includeantruntime="false" srcdir="src;gen" destdir="build/compiled" deprecation="on" target="1.7" source="1.7" debug="true" debuglevel="lines,vars,source" verbose="false" classpathref="project.classpath" encoding="utf-8" />
我正在寻找输出jar中存在参数名称的证据。
目前我唯一的证据是使用Eclipse反编译器,这些信息不存在。 我正在使用Enhanced Class Decompiler插件
源代码:
public interface UserManager extends BaseManager<DBUser>
{
List<Localizable> getPasswordPolicyDescription();
void checkIfExists(String id);
DBUser create(String id, String userName, String email, String cultureId, String parentId, LocalDate accountExpirationDate,
LocalDate passwordExpirationDate, String password, boolean enabled)
throws PasswordPolicyException, UserAlreadyExistsException;
DBUser create(String id, String completeName, String email, String cultureId) throws PhoenixWarningException;
DBUser update(String id, String completeName, String password, String email, String cultureId, String parentId, boolean enabled,
LocalDate accountExpirationDate, LocalDate passwordExpirationDate, Collection<? extends String> assignedRoles)
throws PasswordPolicyException;
DBUser update(String id, String completeName, String password, String email, String cultureId, String parentId, boolean enabled,
LocalDate accountExpirationDate, LocalDate passwordExpirationDate, String... assignedRoles)
throws PasswordPolicyException;
使用Eclipse反编译器从jar加载相同的类
public interface UserManager extends BaseManager<DBUser> {
List<Localizable> getPasswordPolicyDescription();
void checkIfExists(String arg0);
DBUser create(String arg0, String arg1, String arg2, String arg3, String arg4, LocalDate arg5, LocalDate arg6,
String arg7, boolean arg8) throws PasswordPolicyException, UserAlreadyExistsException;
DBUser create(String arg0, String arg1, String arg2, String arg3) throws PhoenixWarningException;
DBUser update(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5, boolean arg6,
LocalDate arg7, LocalDate arg8, Collection<? extends String> arg9) throws PasswordPolicyException;
DBUser update(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5, boolean arg6,
LocalDate arg7, LocalDate arg8, String... arg9) throws PasswordPolicyException;
如果我尝试将任何Spring框架类加载到反编译器中,我会正确获取变量名称,并且也会发表评论!!!
/**
* Interface that encapsulates event publication functionality.
* Serves as super-interface for {@link ApplicationContext}.
*
* @author Juergen Hoeller
* @author Stephane Nicoll
* @since 1.1.1
* @see ApplicationContext
* @see ApplicationEventPublisherAware
* @see org.springframework.context.ApplicationEvent
* @see org.springframework.context.event.EventPublicationInterceptor
*/
public interface ApplicationEventPublisher {
/**
* Notify all <strong>matching</strong> listeners registered with this
* application of an application event. Events may be framework events
* (such as RequestHandledEvent) or application-specific events.
* @param event the event to publish
* @see org.springframework.web.context.support.RequestHandledEvent
*/
void publishEvent(ApplicationEvent event);
/**
* Notify all <strong>matching</strong> listeners registered with this
* application of an event.
* <p>If the specified {@code event} is not an {@link ApplicationEvent},
* it is wrapped in a {@link PayloadApplicationEvent}.
* @param event the event to publish
* @since 4.2
* @see PayloadApplicationEvent
*/
void publishEvent(Object event);
}
问题(S)
我jave尝试javap -v UserManager.class | grep userId
但没有显示任何内容。我假设参数名称userId已经显示在某个地方
考虑以下Spring Framework类AsyncListenableTaskExecutor
public interface AsyncListenableTaskExecutor extends AsyncTaskExecutor {
ListenableFuture<?> submitListenable(Runnable task);
<T> ListenableFuture<T> submitListenable(Callable<T> task);
}
如您所见,参数名称为task
。我在类路径中从Spring核心的jar中提取了AsyncListenableTaskExecutor.class
。然后执行
$ javap -v AsyncListenableTaskExecutor.class
在输出中,我看不到参数名称task
Classfile /Z:/spring-core-4.3.14.RELEASE/org/springframework/core/task/AsyncListenableTaskExecutor.class
Last modified 23-gen-2018; size 656 bytes
MD5 checksum 3c1894a7d3d48ce79991d55c4984dcf7
Compiled from "AsyncListenableTaskExecutor.java"
public interface org.springframework.core.task.AsyncListenableTaskExecutor extends org.springframework.core.task.AsyncTaskExecutor
minor version: 0
major version: 50
flags: ACC_PUBLIC, ACC_INTERFACE, ACC_ABSTRACT
Constant pool:
#1 = Class #12 // org/springframework/core/task/AsyncListenableTaskExecutor
#2 = Class #13 // java/lang/Object
#3 = Class #14 // org/springframework/core/task/AsyncTaskExecutor
#4 = Utf8 submitListenable
#5 = Utf8 (Ljava/lang/Runnable;)Lorg/springframework/util/concurrent/ListenableFuture;
#6 = Utf8 Signature
#7 = Utf8 (Ljava/lang/Runnable;)Lorg/springframework/util/concurrent/ListenableFuture<*>;
#8 = Utf8 (Ljava/util/concurrent/Callable;)Lorg/springframework/util/concurrent/ListenableFuture;
#9 = Utf8 <T:Ljava/lang/Object;>(Ljava/util/concurrent/Callable<TT;>;)Lorg/springframework/util/concurrent/ListenableFuture<TT;>;
#10 = Utf8 SourceFile
#11 = Utf8 AsyncListenableTaskExecutor.java
#12 = Utf8 org/springframework/core/task/AsyncListenableTaskExecutor
#13 = Utf8 java/lang/Object
#14 = Utf8 org/springframework/core/task/AsyncTaskExecutor
{
public abstract org.springframework.util.concurrent.ListenableFuture<?> submitListenable(java.lang.Runnable);
descriptor: (Ljava/lang/Runnable;)Lorg/springframework/util/concurrent/ListenableFuture;
flags: ACC_PUBLIC, ACC_ABSTRACT
Signature: #7 // (Ljava/lang/Runnable;)Lorg/springframework/util/concurrent/ListenableFuture<*>;
public abstract <T extends java.lang.Object> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(java.util.concurrent.Callable<T>);
descriptor: (Ljava/util/concurrent/Callable;)Lorg/springframework/util/concurrent/ListenableFuture;
flags: ACC_PUBLIC, ACC_ABSTRACT
Signature: #9 // <T:Ljava/lang/Object;>(Ljava/util/concurrent/Callable<TT;>;)Lorg/springframework/util/concurrent/ListenableFuture<TT;>;
}
SourceFile: "AsyncListenableTaskExecutor.java"