私のJavaコンパイラは、私のコードが「チェックされていない、または安全でない操作」を使用していると不平を言っています。2つのコードスニペットでどの行がそれを引き起こしているのか考えていますか?
@SuppressWarnings("unchecked")
private final void prepareChannelAccountStringsParserImplementedClassConstructor() {
try {
String channelAccountStringsParserImplementedClassName = channelIdentifier + "AccountStringsParser";
Class channelAccountStringsParserImplementedClass = Class.forName(channelAccountStringsParserImplementedClassName);
Class[] channelAccountStringsParserImplementedClassArguments = new Class[1];
channelAccountStringsParserImplementedClassArguments[0] = String.class;
channelAccountStringsParserImplementedClassConstructor = channelAccountStringsParserImplementedClass.getConstructor(channelAccountStringsParserImplementedClassArguments);
channelAccountStringsParserImplementedParseMethod = channelAccountStringsParserImplementedClass.getMethod("parse", String.class);
channelAccountStringsParserGetRequestIDMethod = channelAccountStringsParserImplementedClass.getMethod("getRequestID");
} catch (ClassNotFoundException classNotFoundException) {
NotifyMeListenersLogsDB notifyMeListenersLogsDB = DatabaseController.getInstance().getNotifyMeListenersLogsDB();
notifyMeListenersLogsDB.writeDeveloperException(classNotFoundException);
} catch (NoSuchMethodException noSuchMethodException) {
NotifyMeListenersLogsDB notifyMeListenersLogsDB = DatabaseController.getInstance().getNotifyMeListenersLogsDB();
notifyMeListenersLogsDB.writeDeveloperException(noSuchMethodException);
}
}
@SuppressWarnings("unchecked")
public synchronized final void requestChannelAccountsCompletionSuccess(String responseContent) {
Object channelAccountStringsParserImplementedInstance;
ArrayList<ChannelAccount> channelAccounts = null;
String requestID = null;
try {
channelAccountStringsParserImplementedInstance = channelAccountStringsParserImplementedClassConstructor.newInstance(responseContent);
channelAccounts = (ArrayList<ChannelAccount>) channelAccountStringsParserImplementedParseMethod.invoke(channelAccountStringsParserImplementedInstance, responseContent);
requestID = (String) channelAccountStringsParserGetRequestIDMethod.invoke(channelAccountStringsParserImplementedInstance);
} catch (InstantiationException instantiationException) {
NotifyMeListenersLogsDB notifyMeListenersLogsDB = DatabaseController.getInstance().getNotifyMeListenersLogsDB();
notifyMeListenersLogsDB.writeDeveloperException(instantiationException);
} catch (IllegalAccessException illegalAccessException) {
NotifyMeListenersLogsDB notifyMeListenersLogsDB = DatabaseController.getInstance().getNotifyMeListenersLogsDB();
notifyMeListenersLogsDB.writeDeveloperException(illegalAccessException);
} catch (InvocationTargetException invocationTargetException) {
NotifyMeListenersLogsDB notifyMeListenersLogsDB = DatabaseController.getInstance().getNotifyMeListenersLogsDB();
notifyMeListenersLogsDB.writeDeveloperException(invocationTargetException);
}
channelAccountStringsParserImplementedInstance = null;
try {
startChannelConnections(channelAccounts);
isStarted = true;
LoadBalancer.getInstance().sendSuccessAcknowledgement(requestID);
} catch (NotifyMeListenersApplicationInitializationException notifyMeListenersApplicationInitializationException) {
NotifyMeListenersLogsDB notifyMeListenersLogsDB = DatabaseController.getInstance().getNotifyMeListenersLogsDB();
notifyMeListenersLogsDB.writeNotifyMeListenersException(notifyMeListenersApplicationInitializationException);
System.exit(1);
}
}
もちろん、@ SuppressWarningsを入れて抑制していますが、原因を知りたいのですが。誰でも助けることができますか?