title: How do you replace the class of a Maven dependency?
body: <p>There is a class in a maven dependency that is incompatible with Java 8. </p>
  
  <p>How do you properly fix that problem? </p>
  
  <p>Right now I'm doing the following: </p>
  
  <ol>
  <li>Create a package with the same name</li>
  <li>Create a class with the same name in that package</li>
  <li>Copy and paste the code</li>
  <li>Fix the incompatible API call</li>
  </ol>
  
  <p>The problem is that this class contains API calls to restricted classes and although I changed the Eclipse compiler settings (Window -> Preferences -> Java -> Compiler -> Error/Warnings -> Deprecated and restricted API -> Forbidden reference (access rule): Error -> Warning) to allow access the project will only compile sometimes. If it doesn't compile I'll get a "can't find symbol" error.</p>
  
  <p>Edit:</p>
  
  <p>Here are the details you asked for:</p>
  
  <ul>
  <li><p>Dependency: <a href="http://mvnrepository.com/artifact/com.sun.xml.wss/xws-security/3.0" rel="noreferrer">http://mvnrepository.com/artifact/com.sun.xml.wss/xws-security/3.0</a></p></li>
  <li><p>Class: EncryptionProcessor</p></li>
  <li><p>Necessary change:</p>
  
  <pre><code>// Change line 1053 FROM: 
  // _dataEncryptor = XMLCipher.getInstance(dataEncAlgo, _dataCipher); 
  // TO:
  _dataEncryptor = XMLCipher.getInstance(dataEncAlgo); 
  </code></pre></li>
  </ul>
  
  <p>Edit-2:</p>
  
  <p>Maven build error:</p>
  
  <pre><code> [ERROR] symbol:   class XMLCipher
   [ERROR] location: class com.sun.xml.wss.impl.apachecrypto.EncryptionProcessor
   [ERROR] /C:/Users/{name}/development/eclipse_workspace/git/xws-security/src/main/java/com/sun/xml/wss/impl/apachecrypto/EncryptionProcessor.java:[1482,98] cannot find symbol
  </code></pre>